?

Search Help Board

PHP FAQ
PHP Articles
PHP Help
Bulletin Board

PHP Manual (NEW!)
First Time PHP'ers
Help with programming
Sql assignment help
PHP Homework Help


C# Help

?
?inserting data from form
Author:??(---.as1.athlone1.eircom.net)
Date:???03-22-03 16:00

hey guys.
i'm new to php and have a problem inserting data into a mysql table from a form. its connecting ok and comes up data inserted successfully and a new row gets created but the data is blank. any help would be appreciated. thanx. my code is below

HTML



Name:
Email:





PHP
$connection=mysql_connect("localhost","pp","mm") or die('Could not connect to the database server');
$db = mysql_select_db("test", $connection) or die ("Unable to select database.");
$sql = "INSERT INTO registration (Name,Email)
VALUES ('$name','$email')";
$sql_result = mysql_query($sql,$connection) or die ('Could not insert data');
echo('Data inserted successfully');
mysql_close($connection);
?>

?Topics Author? Date
?inserting data from form??new
irishstudent 03-22-03 16:00?
?Re: inserting data from form??new
fred 03-23-03 04:13?
?whoops error in above??new
fred 03-23-03 04:15?
?Re: whoops error in above??new
irishstudent 03-23-03 07:52?
?Re: inserting data from form??new
Brian 03-24-03 09:12?
?Re: inserting data from form??new
Jack 03-31-03 12:07?
?Re: inserting data from form??new
Jack 04-08-03 14:26?
Go to Top??|??Go to Topic??|??Flat View??|??Search?
??|??
New Topic
?Reply To This Message
?Your Name:
?Your Email:
?Subject:
Email replies to this thread, to the address above.
??wrote: > > hey guys. > i'm new to php and have a problem inserting data into a mysql > table from a form. its connecting ok and comes up data > inserted successfully and a new row gets created but the data > is blank. any help would be appreciated. thanx. my code is > below > > HTML >
>
> > >
size="4">Name:
Email: > >
> >
> > PHP > $connection=mysql_connect("localhost","pp","mm") or > die('Could not connect to the database server'); > $db = mysql_select_db("test", $connection) or die ("Unable to > select database."); > $sql = "INSERT INTO registration (Name,Email) > VALUES ('$name','$email')"; > $sql_result = mysql_query($sql,$connection) or die ('Could > not insert data'); > echo('Data inserted successfully'); > mysql_close($connection); > ?> ">??

Provided By
Phorum