Foser Posted May 29, 2007 Share Posted May 29, 2007 <?php mysql_connect("localhost","root" , "password") or die (mysql_error()); mysql_select_db("tutorial1") or die (mysql_error()); $personaldata = array("name" => $_POST['name'], "age" => $_POST['age'], "sex" => $_POST['sex']); mysql_query("INSERT INTO personalinfo (name, age, sex) VALUES('$personaldata[name]', '$personaldata[age]', '$personaldata[sex]')") or die(mysql_error()); echo "You've submited this information. <br> name:" .$_POST['name']. "<br> Age:" .$_POST['age']. "<br> Sex: " .$_POST['sex']; ?> for some reason only the Sex value is record, the rest is not, and does not even show up in the echo! maybe the varchar is not correct or something. Keep in my that the Sex value is a select menu where the others are text fields. Quote Link to comment https://forums.phpfreaks.com/topic/53407-solved-my-_post-wont-show-up-once-submited/ Share on other sites More sharing options...
taith Posted May 29, 2007 Share Posted May 29, 2007 if you print_r($_POST); whats it output? Quote Link to comment https://forums.phpfreaks.com/topic/53407-solved-my-_post-wont-show-up-once-submited/#findComment-263869 Share on other sites More sharing options...
Foser Posted May 29, 2007 Author Share Posted May 29, 2007 if i change the array to simpele $_POST[bLABLA] it has the same error Quote Link to comment https://forums.phpfreaks.com/topic/53407-solved-my-_post-wont-show-up-once-submited/#findComment-263880 Share on other sites More sharing options...
MadTechie Posted May 29, 2007 Share Posted May 29, 2007 echo taith also what "error" Quote Link to comment https://forums.phpfreaks.com/topic/53407-solved-my-_post-wont-show-up-once-submited/#findComment-263888 Share on other sites More sharing options...
kenrbnsn Posted May 29, 2007 Share Posted May 29, 2007 Please post the source of the form. Ken Quote Link to comment https://forums.phpfreaks.com/topic/53407-solved-my-_post-wont-show-up-once-submited/#findComment-263895 Share on other sites More sharing options...
Foser Posted May 29, 2007 Author Share Posted May 29, 2007 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Personal Information</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <p> </p> <p> </p> <form name="form3" method="post" action="process.php"> <p>Name: <input type="name" name="textfield"> <br> Age: <input type="age" name="textfield22"> <br> Sex: <select name="sex"> <option value="Male">Male</option> <option value="Female">Female</option> </select> <br> <input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"> </form> </body> </html> I don't get an error, it just does not show. Quote Link to comment https://forums.phpfreaks.com/topic/53407-solved-my-_post-wont-show-up-once-submited/#findComment-263896 Share on other sites More sharing options...
taith Posted May 29, 2007 Share Posted May 29, 2007 echo taith also what "error" lol... why you keep echoing my name!?!? lol besides... there wouldnt be an error... its just inputing the right data ;-) Quote Link to comment https://forums.phpfreaks.com/topic/53407-solved-my-_post-wont-show-up-once-submited/#findComment-263899 Share on other sites More sharing options...
Wildbug Posted May 29, 2007 Share Posted May 29, 2007 <p>Name: <input type="name" name="textfield"> <br> Age: <input type="age" name="textfield22"> <!-- Should be: --> <input name="name" type="text" size=30> <input name="age" type="text" size=3> Quote Link to comment https://forums.phpfreaks.com/topic/53407-solved-my-_post-wont-show-up-once-submited/#findComment-263904 Share on other sites More sharing options...
kenrbnsn Posted May 29, 2007 Share Posted May 29, 2007 The problem is that the names of the fields that are not showing up are not "name" and "age" but "textfield" and "textfield22". Either change the PHP code to match the form or change the form to match the PHP code. Ken Quote Link to comment https://forums.phpfreaks.com/topic/53407-solved-my-_post-wont-show-up-once-submited/#findComment-263908 Share on other sites More sharing options...
Foser Posted May 29, 2007 Author Share Posted May 29, 2007 <p>Name: <input type="name" name="textfield"> <br> Age: <input type="age" name="textfield22"> <!-- Should be: --> <input name="name" type="text" size=30> <input name="age" type="text" size=3> I changed the code, and this still has the same problem. Quote Link to comment https://forums.phpfreaks.com/topic/53407-solved-my-_post-wont-show-up-once-submited/#findComment-263925 Share on other sites More sharing options...
Wildbug Posted May 29, 2007 Share Posted May 29, 2007 Eh... what? Can I see (a) your new code and (b) an: echo '<pre>', print_r($_POST,true),'</pre>'; Quote Link to comment https://forums.phpfreaks.com/topic/53407-solved-my-_post-wont-show-up-once-submited/#findComment-263929 Share on other sites More sharing options...
Foser Posted May 29, 2007 Author Share Posted May 29, 2007 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Personal Information</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <p> </p> <p> </p> <form name="form3" method="post" action="process.php"> <p>Name: <input name="name" type="text" size=30> <br> Age: <input name="age" type="text" size=3> <br> Sex: <select name="sex"> <option value="Male">Male</option> <option value="Female">Female</option> </select> <br> <input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"> </form> </body> </html> <?php mysql_connect("localhost","root" , "password") or die (mysql_error()); mysql_select_db("tutorial1") or die (mysql_error()); $personaldata = array("name" => $_POST['name'], "age" => $_POST['age'], "sex" => $_POST['sex']); mysql_query("INSERT INTO personalinfo (name, age, sex) VALUES('$personaldata[name]', '$personaldata[age]', '$personaldata[sex]')") or die(mysql_error()); echo "You've submited this information. <br> name:" .$_POST['name']. "<br> Age:" .$_POST['age']. "<br> Sex: " .$_POST['sex']; ?> Quote Link to comment https://forums.phpfreaks.com/topic/53407-solved-my-_post-wont-show-up-once-submited/#findComment-263930 Share on other sites More sharing options...
Wildbug Posted May 29, 2007 Share Posted May 29, 2007 That is an oddity. Can you do a print_r($_POST) for us, just for completeness? I can't see anything wrong in the code at this point and would like to see if things are getting passed to PHP. Quote Link to comment https://forums.phpfreaks.com/topic/53407-solved-my-_post-wont-show-up-once-submited/#findComment-263940 Share on other sites More sharing options...
Foser Posted May 29, 2007 Author Share Posted May 29, 2007 Sex: MaleArray ( [textfield] => Foster [textfield22] => 15 [sex] => Male [submit] => Submit ) 1 thats what I get Also with the topper things like Name: with nothing after it and age with nothing, Quote Link to comment https://forums.phpfreaks.com/topic/53407-solved-my-_post-wont-show-up-once-submited/#findComment-263951 Share on other sites More sharing options...
kenrbnsn Posted May 29, 2007 Share Posted May 29, 2007 You didn't upload the changed form to your server. Ken Quote Link to comment https://forums.phpfreaks.com/topic/53407-solved-my-_post-wont-show-up-once-submited/#findComment-263957 Share on other sites More sharing options...
Foser Posted May 29, 2007 Author Share Posted May 29, 2007 You've submited this information. name:Foster Age:15 Sex: MaleArray ( [name] => Foster [age] => 15 [sex] => Male [submit] => Submit ) 1 got this now i restarted the services on wamp... Quote Link to comment https://forums.phpfreaks.com/topic/53407-solved-my-_post-wont-show-up-once-submited/#findComment-263969 Share on other sites More sharing options...
Foser Posted May 29, 2007 Author Share Posted May 29, 2007 oh it works! thanks ahaha Quote Link to comment https://forums.phpfreaks.com/topic/53407-solved-my-_post-wont-show-up-once-submited/#findComment-263972 Share on other sites More sharing options...
MadTechie Posted May 29, 2007 Share Posted May 29, 2007 the error was because of this quote if i change the array to simpele $_POST[bLABLA] it has the same error the reason for the echo taith was its quicker to say echo taith than a) repeat what you said b) quicker than typing agree's with taith yeah what taith said did you even attempt what taith said c) its shorter that typing print(taith); LOL Quote Link to comment https://forums.phpfreaks.com/topic/53407-solved-my-_post-wont-show-up-once-submited/#findComment-263988 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.