RE: [PHP] Re: how to insert form data
| From: | Jay Blanchard | Date: | Wed, 02 Jun 2004 12:23:39 +0000 |
| Subject: | RE: [PHP] Re: how to insert form data | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-187444@lists.php.net to get a copy of this message | ||
[snip]
Well getting closer now, its inserting into the tables but they are
blank
(no text)
[/snip]
let's go short...(and watch for/avoid keywords like 'name')
form.php
<form action="input.php" method="POST">
<input type="text" name="username">
<input type="submit" name="submit" value="Submit">
</form>
input.php
<?php
$username = $_POST['username'];
echo $username . "<br>\n";
$sql = "INSERT INTO whosaid (username) VALUES ('" . $username . "');
if(!($insert = mysql_query($sql, $yourConnectionString))){
echo mysql_error . "\n";
exit();
}
?>