PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Thanks for your reply.
I cut'n'pasted that line, and i get a parse error:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
i really dont think that you did. My code works perfect, i jsut tested it. It something with your other code. It might help if you post al you code around there
for some reason, if i remove the quotes from PHP_SELF, it parses.
<form action="<?php echo $_SERVER[PHP_SELF]; ?>" method="post">
this isn't right, though, i know the quotes need to be there.
<!-- create hidden field with unique id to prevent multiple submission of same form -->
<input type="hidden" name="token" value="<?php echo $token; ?>">
LiLpunkSkateR,
Your code that takes the $_SERVER['PHP_SELF'] out of the <form...> tag works!
I still have one problem though.
'token' is being assigned a value (a 32 character string) in the print_form function, but the value doesn't seem to make it to the process_form function. I echo the value of token and when it is assigned (e.g. 86a7b6e6e8412e8aecc9e88ed58fd06a), but when I print it out in the process_form function, it seems to have lost its value (nothing is output from the echo statement).
So the value is being assigned to the value $token, but apparently not making it into the $_POST array (in $_POST['token']). This would poin t to an error in the hidden field tag:
<input type="hidden" name="token" value="<?php echo $token; ?>">
<!-- create hidden field with unique id to prevent multiple submission of same form -->
<input type="hidden" name="token" value="<?php echo $token; ?>">
<input type="hidden" name="stage" value="process">
<input type="submit" value="Submit">
</form>
END;
}
// ----------------------------------------------------------------------------
// process form
// validate, submit form data to db, start download
// ----------------------------------------------------------------------------
function process_form()
{
echo 'Thanks for submitting, ' . $_POST['firstName'] ;
echo '<br>';
echo 'token: ' . $_POST['token'] ;
echo '<br>';