I am using redhat 7.3 with mysql-3.23.49-3 php-4.1.2-7.3.4 
I want to insert few values into a mysql table. This input.php sort 
works. it will add a new entray to the table but with blank values. What 
did I do wrong?
# file name input.php

$db_name ="cheese_catalog";
$table_name = "user";
$connection = @mysql_connect("localhost","test","test") or die("Couldn't 
$db = @mysql_select_db($db_name, $connection) or die("Couldn't select 
if ("none_required"=="none_required") {

$sql = "INSERT INTO $table_name (first_name,location,phone,messages) 
VALUES (\"$first_name\",\"$location\",\"$phone\", \"$messages\");";
$result = @mysql_query($sql, $connection) or die("Error #". 
mysql_errno() . ": " . mysql_error());




# file name input.html
<title>New Record</title>
<p>Please fill out the following information:</p>
<form method="post" action="input.php"" enctype="multipart/form-data">
<table width="100%" border="0" cellspacing="3" cellpadding="3">
           <td width="25%">first_name:</td>
           <td width="75%"><input name="first_name" type="text" size=40 
maxlength=255 value=""></td>
           <td width="25%">location:</td>
           <td width="75%"><input name="location" type="text" size=40 
maxlength=255 value=""></td>
           <td width="25%">phone:</td>
           <td width="75%"><input name="phone" type="text" size=40 
maxlength=255 value=""></td>
          <td width="25%">messages:</td>
           <td width="75%"><input name="messages" type="text" size=40 
maxlength=255 value=""></td>
           <td width="25%">&nbsp;</td>
           <td width="75%" align="left"><input type="submit" 
name="submit" value="Enter">&nbsp<input type="reset" name="reset"></td>

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to