why doesn't this add
| From: | David McGlone | Date: | Mon, 26 May 2003 00:50:27 +0000 |
| Subject: | why doesn't this add | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-148937@lists.php.net to get a copy of this message | ||
Hi all,
Why is this code not adding the text in the textbox into the database:
I've tried everything like $_POST['mylink'], '$_POST['mylink']
',
"$_POST['mylink']"
I can say that '$_POST['mylink'] ' adds a record into the database, but
it's a
blank record.
echo("<form action=\"addtodb.php\" method=\"POST\">"
."<input type=\"text\" name=\"mylink\"
maxlength=\"50\"><br>"
."<input type=\"submit\" value=\"add link\"><br>"
."</form>");
$host = "localhost";
$user = "xxxxxx";
$pass = "xxxxxxxxxxxxxxxx";
//make our connection details
$connection = mysql_connect("$host" , "$user" , "$pass")
or die ("Cannot make the connection");
//connect to sampledb with our connection details
$db = mysql_select_db("addtodb" , $connection)
or die ("Cannot connect to the database");
//insert the text box data into the sample table
$sql_query = "INSERT INTO tshirts VALUES ('' ,
'$_POST['mylink']')";
$result = mysql_query($sql_query);
Thanks,
--
David M.
Edification Web Solutions
http://www.edificationweb.com