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!
I have got my form showing just fine now but the error printing is not working. If I click submit without entering any information in the fields the form refreshes but does not show the error messages, also if I do fill in all the details the form still refreshes.
Is there anyone who can take a quick butchers at the code?
I didnt look at it all in detail, and from a programming point of view it is messy and a bit unusual....
First of all it looks like you depend on register globals being on, you should use the $_REQUEST['varname'] variable instead, and use stripslashes() for the values if magic_quotes_gpc is on..
Here is a simpler sample, this one is also wildly mixing code and content
Its all a learning curve for me - I will get there (one day)
I am also getting confused with using option select drop downs, I am not 100% sure how I can validate so an error shows if they did not select yes or no and just submitted leaving the 'Please Select' untouched:
...
<option value="1">Yes</option>
<option value="0">No</option>
...
<?php
if (empty($_REQUEST['fchildren']))
{
// No was selected
$err[] = 'You cant select NO you son of a Gates';
}
else
{
// Yes was selected
}
?>
How do I make the selected input options remain selected when the page refreshes to show items that were not enetered or selected?
At the moment when the page refreshes to show errors the 'please select' lists go back to 'please select' instead of showing what might have been selected.