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] Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 29, 2007 Share Posted January 29, 2007 And the problem is?print_r($_POST) Quote Link to comment 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 Quote Link to comment 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']); Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 29, 2007 Share Posted January 29, 2007 Yes. Quote Link to comment 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.