Hi,
This current problem of mine is driving me nuts, there has to a solution. I'm farily new to PHP and have a couple questions which hopefully can be answered. I have two files, contact.php contains a form, with a drop down list. When the user hits the submit button, they are directed toward tutorialcontact_result.php which catches any errors. If there is an error, on this page I provide a link back to contact.php. My first problem is: I'm trying to validate a drop down list using a regular expression as shown below:
if(eregi("[a-z | A-Z]+", $_POST['whichtutorial'])){
$d=true;
}else{
$d=false;
$message[]="Please select a tutorial.";
}
My drop down list contains characters, a hyphen, and numbers, the above is not working currently. I believe this regular expression only accounts for characters lowercase a-z and uppercase A-Z. Does anyone know what the regular could be?
Secondly, I want to retain the value the user selects from the drop down menu through sessions, which is currently working on my other form fiels except on the drop down list. The code below is my attempt which isn't working:
<select name="whichtutorial">
<?php echo $_SESSION['tutorial_memory']['whichtutorial'];?>
<option value="<?php echo $_SESSION['tutorial_memory']['definingsitemx'];?>null">--------------</option>
<option value="definingsitedwmx">Defining Site, DW MX</option>
<option Value="miscellaneoussubjectlines">Miscellaneous — Subject Lines</option>
</select>
If anyone knows a solution to the problem(s), it would be of great help. I'm stuck currently on this even through Google.
Thanks,