Jump to content

[SOLVED] Help please.. form won't submit hidden properly


twilightnights

Recommended Posts

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]
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']);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.