dudejma Posted July 10, 2010 Share Posted July 10, 2010 I have a form that I'm wanting to insert into my database. This is the form: <!-- Text container --> <div class="contentbox-container"> <div class="contentbox-full"> <div class="contentbox-title-shading-small bg-blue04 box-on"> </div> <div class="contentbox-title-shading-small">Personal Information</div> <div class="contentbox-noshading"> <form action="insert.php" action="post"> <p><b>NOTE</b>: Only register if you are planning on using our services. The only point in registering is to access the invoice system.</p> First Name: <input type="text" name="firstname" value=""> Last Name: <input type="text" name="lastname" value=""> <br /> <br /> Address: <input type="text" size="40" name="address" value=""> <br /> <br /> City: <input type="text" name="city" value="">, State: <input type="text" name="state" value=""> <br /> <br /> Zip: <input type="text" name="zip" value=""> <br /> <br /> Phone Number: <input type="text" name="phone" value=""> <br /> <br /> Email: <input type="text" name="email" value=""> <br /> </div> </div> </div> <!-- Text container --> <div class="contentbox-container"> <div class="contentbox-full"> <div class="contentbox-title-shading-small bg-blue04 box-on"> </div> <div class="contentbox-title-shading-small">Account Information</div> <div class="contentbox-noshading"> Username: <input type="text" name="username" value=""> <br /> <br /> Password: <input type="password" name="password" value=""> <br /> <br /> Password again: <input type="password" name="password2" value=""> <br /> <br /> <input type="submit" value="Submit"> <input type="reset" value="Reset"> </form> </div> </div> </div> </div> insert.php <?php $con = mysql_connect("localhost","virtu857_newuser","mypassword"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("virtu857_newusers", $con); $sql="INSERT INTO Users (firstname, lastname, address, city, state, zip, phone, email, username, password) VALUES ('$_POST[firstname]','$_POST[lastname]','$_POST[address]','$_POST[city]','$_POST[state]','$_POST[zip]','$_POST[phone]','$_POST[email]','$_POST[username]','$_POST[password]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } header( 'Location: http://aandwtechsupport.co.cc/registered.html' ) ; mysql_close($con) ?> It redirects me to the completion page, but doesn't actually insert the data. It insert's blank fields. Quote Link to comment https://forums.phpfreaks.com/topic/207313-whats-wrong/ Share on other sites More sharing options...
PFMaBiSmAd Posted July 10, 2010 Share Posted July 10, 2010 action="post" ^^^ That should be method="post" As it says in my signature, you need to check WHAT your code is receiving as the first debugging step. You would have found that it was receiving $_GET data. Quote Link to comment https://forums.phpfreaks.com/topic/207313-whats-wrong/#findComment-1083891 Share on other sites More sharing options...
dudejma Posted July 10, 2010 Author Share Posted July 10, 2010 Thanks! How in the world did I miss that?!?!? LOL! Thanks, once again! Quote Link to comment https://forums.phpfreaks.com/topic/207313-whats-wrong/#findComment-1083897 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.