Boxwell
01-23-2008, 10:04 AM
Hello,
I'm really new to php and am looking to create a database from people adding their email address using a submit button. I'm getting the following error:
Parse error: syntax error, unexpected T_VARIABLE in /usr/local/psa/home/vhosts/******.com/httpdocs/emailadd.php on line 15
(I've starred out the webaddress)
Here is the HTML form code:
<html>
<body>
<form action="emailadd.php" method="post">
Email: <input type="text" name="emailadd" />
<input type="submit" />
</form>
</body>
</html>
and this is the php code:
<?php
$user="******";
$password="********";
$database="MailingList";
$connection = mysql_connect('localhost',$user,$password);
if (!$connection)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db($database)
$emailadd = $_POST['emailadd'];
if($emailadd != ""){
$query="INSERT INTO 'EmailAddresses'('Email') VALUES ($emailadd)";
}
mysql_close($connection);
?>
I'm a bit stuck, if anyone can help me it will be greatly appreciated.
Thanks
Graeme
I'm really new to php and am looking to create a database from people adding their email address using a submit button. I'm getting the following error:
Parse error: syntax error, unexpected T_VARIABLE in /usr/local/psa/home/vhosts/******.com/httpdocs/emailadd.php on line 15
(I've starred out the webaddress)
Here is the HTML form code:
<html>
<body>
<form action="emailadd.php" method="post">
Email: <input type="text" name="emailadd" />
<input type="submit" />
</form>
</body>
</html>
and this is the php code:
<?php
$user="******";
$password="********";
$database="MailingList";
$connection = mysql_connect('localhost',$user,$password);
if (!$connection)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db($database)
$emailadd = $_POST['emailadd'];
if($emailadd != ""){
$query="INSERT INTO 'EmailAddresses'('Email') VALUES ($emailadd)";
}
mysql_close($connection);
?>
I'm a bit stuck, if anyone can help me it will be greatly appreciated.
Thanks
Graeme