twilightnights Posted January 29, 2007 Share Posted January 29, 2007 Hi, I'm having a problem with a form not receiving values properly. Any help appreciated. Slashes are used in PHP.form code[code]<form action=\"http://www.omgjokes.com/submitjoke2.php\" method=\"post\"><B>Does this look alright? </b> <br><br><INPUT type=\"hidden\" name=\"author\" value=\"$subauthor\"><INPUT type=\"hidden\" name=\"jokename\" value=\"$subname\"><INPUT type=\"hidden\" name=\"strcat1\" value=\"$strcat1\"><INPUT type=\"hidden\" name=\"jokebody\" value=\"$subbody\"><INPUT type=\"hidden\" name=\"jokeanswer\" value=\"$subanswer\"><input type=\"submit\" value=\"yes\"></form>[/code]when viewing my website source:[code]<form action="http://www.omgjokes.com/submitjoke2.php" method="post"><B>Does this look alright? </b> <br><br><INPUT type="hidden" name="author" value=""><INPUT type="hidden" name="jokename" value="sda"><INPUT type="hidden" name="strcat1" value="Blonde,Insults,Medical"><INPUT type="hidden" name="jokebody" value="sad"><INPUT type="hidden" name="jokeanswer" value="none"><input type="submit" value="yes"></form>[/code]Receiving the posted values[code]$subname = $_POST['jokename'];$strcat1 = $_POST['strcat1'];$subbody = $_POST['jokebody'];$subauthor= $_POST['author'];$subanswer= $_POST['jokeanswer'];[/code] Link to comment https://forums.phpfreaks.com/topic/36143-solved-help-please-form-wont-submit-hidden-properly/ Share on other sites More sharing options...
Jessica Posted January 29, 2007 Share Posted January 29, 2007 And the problem is?print_r($_POST) Link to comment https://forums.phpfreaks.com/topic/36143-solved-help-please-form-wont-submit-hidden-properly/#findComment-171619 Share on other sites More sharing options...
twilightnights Posted January 29, 2007 Author Share Posted January 29, 2007 wow....I was having a problem with it not taking a value into the variable, but now it works all of the sudden when I was going to post the outputsorry for bother Link to comment https://forums.phpfreaks.com/topic/36143-solved-help-please-form-wont-submit-hidden-properly/#findComment-171623 Share on other sites More sharing options...
twilightnights Posted January 29, 2007 Author Share Posted January 29, 2007 I have a related question though. Is it necessary for me to mysql_real_escape_string() around my posts to prevent mysql injection? How would I do it, like this?$subanswer= mysql_real_escape_string($_POST['jokeanswer']); Link to comment https://forums.phpfreaks.com/topic/36143-solved-help-please-form-wont-submit-hidden-properly/#findComment-171631 Share on other sites More sharing options...
Jessica Posted January 29, 2007 Share Posted January 29, 2007 Yes. Link to comment https://forums.phpfreaks.com/topic/36143-solved-help-please-form-wont-submit-hidden-properly/#findComment-171639 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.