mattmcb Posted June 21, 2004 Posted June 21, 2004 I need some help, for some reason only the SELECT form type has a problem when I process the form twice. All the other variables continue to appear no matter how many times I process the form except for the SELECT types. I can process the form once and it stays, but twice and it's gone. Please check out the code and let me know what you think: *The variable is month1 if (!isset($_POST['month1'])) $_POST['month1'] = ''; // function to output form and hold previously entered values. function user_form() { // now to output the form HTML. echo (' <form method="post" action="'.htmlspecialchars($_SERVER['PHP_SELF']).'">'); if (!$_POST['month1']){ echo (' <select name="month1"><option value="">[Select One]<option value="January">January<option value="February">February<option value="March">March<option value="April">April<option value="May">May<option value="June">June<option value="July">July<option value="August">August<option value="September">September<option value="October">October<option value="November">November<option value="December">December</select> ');}else{ echo htmlspecialchars($month1); } '); } // has the form been submitted? if (isset($_POST['submit'])) { // the form has been submitted // perform data checks. //POST Contract Variables $month1 = $_POST['month1']; //Strip Slashes from Contract Variables $month1 = stripslashes(month1); } //Error checking here // Show the form again! user_form(); exit(); // if the error checking has failed, we'll exit the script! } }else { // the form has not been submitted, let's show it user_form(); } Quote
mattmcb Posted June 21, 2004 Author Posted June 21, 2004 Nevermind... I'm an idiot. I wasn't saving the variable each time... I was just printing it out and not capturing it again. Quote
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.
Note: Your post will require moderator approval before it will be visible.