Re: Wont create data in my tables.
| From: | Seung Hwan Kang | Date: | Sat, 19 Apr 2003 12:36:07 +0000 |
| Subject: | Re: Wont create data in my tables. | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-19497@lists.php.net to get a copy of this message | ||
Hello Morten,
if you are using PHP 4.3.x, register_globals is off by default. It means that whenever you post data. You have to use either $_POST or $_GET. eg. $_POST["name"] or $_POST"name"]
Morten Nielsen wrote:
Hi everybody I'm following the book called "MySQL / PHP Database Applications", i'm trying to write the Guestbook application. The problem is with creating data in the tables. Can anybody tell me if this code is correct or not ?. <?php include("dbconnect.php"); ?> <?php //> if ($submit =="Sign!")if ($_POST["submit"] == "Sign!")
{ $query = "insert into guestbook (name,location,email,url,comments) //> values ('$name', '$location', '$email', '$url', '$comments')";values ('$_POST["name"]', '$_POST["location"]', '$_POST["email"]', '$_POST["url"]', '$_POST["comments"]')";
mysql_query($query) or die (mysql_error()) ?> <h2>Thanks</h2> <h2> <a href="view.php">View My Guestbook</a></h2> <?php } else { include ("guestbook.php"); } ?> The code in dbconnect.php is working as i can view the data in the database with view.php, if i creat them manualy. Thanks for any help i can get. Regards Morten