master82 Posted June 7, 2006 Share Posted June 7, 2006 I've created a form, on this form is a dropdown box with the name male (value=m) and female (value=f).Once the form is submitted I am able to retrieve all the input data from the text fields - however the dropdown field always shows up as blank.I'm using...$gender=$_POST['gender'];...to retrieve the values in a variable,Any idea what I could be doing wrong? Quote Link to comment https://forums.phpfreaks.com/topic/11410-retrieves-blank-data-from-dropdown-box/ Share on other sites More sharing options...
ober Posted June 7, 2006 Share Posted June 7, 2006 It would help if you posted the code for the drop-down. It sounds like you're not putting any values in the options... you're just echoing the selections between the option tags.You should have:<option value="male">male</option>It sounds like you have:<option>male</option> or just <option>male Quote Link to comment https://forums.phpfreaks.com/topic/11410-retrieves-blank-data-from-dropdown-box/#findComment-42806 Share on other sites More sharing options...
master82 Posted June 7, 2006 Author Share Posted June 7, 2006 Heres the registration form:[code]<form name="register" method="post" action="addme.php"> <label> <p align="center">Requested Username<br> <input type="text" name="username" tabindex="1"> </p> <p align="center"> <label>Password<br> <input type="password" name="password" tabindex="2"> </label> </p> <p align="center"> <label>Verify Password<br> <input type="password" name="password2" tabindex="3"> </label> </p> <p align="center"> <label>Email<br> <input type="text" name="email" tabindex="4"> </label> </p> <p align="center"> <label>Gender<br> <select name="gender" tabindex="5"> <option value="m">Male</option> <option value="f">Female</option> </select> </label> <p align="center"> <input type="submit" name="Submit" value="Submit" tabindex="6"></p></form>[/code]And here is part of the .php that processes it:[code]...$username=$_POST['username'];$password=$_POST['password'];$password2=$_POST['password2'];$email=$_POST['email'];$gender=$_POST['gender'];$joined=date("y-m-d");...[/code]When I echo or print $gender its blankSee any problems? Quote Link to comment https://forums.phpfreaks.com/topic/11410-retrieves-blank-data-from-dropdown-box/#findComment-42895 Share on other sites More sharing options...
master82 Posted June 7, 2006 Author Share Posted June 7, 2006 Amazing what a quick restart does!Have no idea what changed but its working - I think I needed to empty my cacheThanks anyway Quote Link to comment https://forums.phpfreaks.com/topic/11410-retrieves-blank-data-from-dropdown-box/#findComment-42901 Share on other sites More sharing options...
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.