Jump to content

Database Insert ... can’t get it done


Recommended Posts

Hi,

I’ve checked 2 books and 3 web tutorials on this, but the data still wouldn’t add to my customer table ... who can give me a hint what’s wrong.

 

 

Here is the html form file

 

<html>

<body>

 

Fill out to insert to table "customer"<p>

 

<form name="form1" method="get"

action="newcustomer.php">

 

Name: <input type="text" name="name"><p>

Email address:

 

<input type="text" name="email"><p>

<input type="submit" name="Submit"

value="Submit">

</form>

 

</body>

</html>

 

 

 

 

Here is the process.php file

 

<html><title>Simple Insert ...</title>

<body>

 

<?php

 

$name = $_GET["name"];

$email = $_GET["email"];

$now = date("Y-m-d");

print "Name is $name<br>\n";

print "Email is $email<br>\n";

 

mysql_connect("localhost", "fhx", "dududu");

 

$result = mysql_query(

"insert into phpbase.customer

(name, email, signup, last_access) values

('$name', '$email', '$now', '$now')"

);

if ($result) {

print <<<EOT

Inserting successfull !

EOT;

}

else {

print "Inserting went wrong !";

}

 

mysql_close();

?>

</body></html>

 

 

 

 

 

This is my database

www.hfpz.net/support/php/database_01.jpg

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.