Forum Moderators: coopster
i have a html form with 3 simple text boxes, "user, addy, webpage" when i hit submit i wanna have the info in the boxes saved in my db members under "name,email,website" i've noticed if i name the form elements the same as the coloum names it will pose a problem.
i'm not asking for the code, but for someone to look at my code and point me in the right direction
<!---html code---!>
<form action="mysql2.php" method="POST">
Your name: <input type="text" name="user" value="user"/>
Your emailput type="text" name="addy" value="addy" />
Your webpaget type="text" name="webpage" value="webpage"/>
<input type="submit">
</form>
<!---end html code---!>
<!---php code---!>
<?php
$connection = mysql_connect("localhost", "neonerz", "password") or die("Error connecting to database");
mysql_select_db("neonerz_members", $connection);
$query = "INSERT INTO members (name , email , website ) VALUES ( $_GET["user"] , $_GET["addy"] , $_GET["webpage"] )";
/*`*/
$result = MYSQL_QUERY($query);
?>
<!---end php code---!>
thanx for any help you might be able to offer me
<$query = "INSERT INTO members (name , email , website ) VALUES ( $_GET["user"] , $_GET["addy"] , $_GET["webpage"] )";>
I think you may need to put tick-marks around your inserted values. Something like this may work better in the above statement:
('" . $_GET["user"] . "','" . $_GET["addy"] . "','" . $_GET["webpage"] . "')
Not sure.. just a thought. I just started using MySQL about two months ago, so I haven't yet learned all of the ins-and-outs of what formatting quirks may or may not exist :-).
INSERT INTO members (name, email, website) VALUES ('uservalue', 'addyvalue', 'webpagevalue');
$query = "INSERT INTO members (name , email , website ) VALUES ('" . $_GET["user"] . "','" . $_GET["addy"] . "','" . $_GET["webpage"] . "')";
Regards -- coopster