The_Thorn Posted February 9, 2014 Share Posted February 9, 2014 Hello. I have been working on and researching this issue for the past day without resolution: When a User selects a country via a dropdown on a form, upon submission it should be added to the table. But it isn't. I've tried everything I can think of. DB connection is fine - All other fields in the form go into the table properly. It's just the country dropdown I'm having problems with. NOTE: This also include HTML $con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die("Failed to connect to MySQL: " . mysql_error()); $db=mysql_select_db(DB_NAME,$con) or die("Failed to connect to MySQL: " . mysql_error()); function NewUser() { $userName = $_POST['user']; $email = $_POST['email']; $password = $_POST['pass']; $countries = $_POST['countries']; $query = "INSERT INTO WebsiteUsers (user,email,pass,countries) VALUES ('$userName','$email','$password', '$countries')"; $data = mysql_query ($query)or die(mysql_error()); if($data) { echo "YOUR REGISTRATION IS COMPLETED..."; } } ... <div id="toppanel"> <div id="panel"> <div class="content clearfix"> <div class="left"> <h1>Welcome to ***********</h1> <p class="grey">You can put anything you want in this sliding panel:</p> </div> <div class="left"> <!-- Login Form --> <form class="clearfix" action="#" method="post"> <h1>Member Login</h1> <label class="grey" for="log">Username:</label> <input class="field" type="text" name="log" id="log" value="" si ze="23" /> <label class="grey" for="pwd">Password:</label> <input class="field" type="password" name="pwd" id="pwd" size="23" /> <div class="clear"></div> <input type="submit" name="submit" value="Login" class="bt_login" /> </form> </div> <div class="left right"> <!-- Register Form --> <form method="POST" action="dbConnect.php"> <h1>Not a member yet? Sign Up!</h1> <!-- Username Field --> <label class="grey" for="signup">Username:</label> <input class="field" type="text" name="user" id="user" value="" size="23" /> <!-- Email Field(s) --> <label class="grey" for="email">Email:</label> <input class="field" type="text" name="email" id="email" size="23" /> <!-- Password Field --> <label class="grey" for="email">Password:</label> <input class="field" type="text" name="pass" id="pass" size="23" /> <Continued> <label class="grey" for="dropdown">Country:</label> <name="pass" id="pass"/> <select name="countries" id="countries" style="width:290px;"> <option value='us' data-image="images/msdropdown/icons/blank.gif" data-imagecss="flag us" data-title="United States" selected="selected">United States</option> <option value='ad' data-image="images/msdropdown/icons/blank.gif" data-imagecss="flag ad" data-title="Andorra">Andorra</option> I'm sorry for the sloppy formatting - It's still rough. (*Full code available upon request) Thank you in advance for any assistance! Matthew *I apologize if this is in the wrong section - Admin/Mods please move if necessary. Thank you.* Link to comment https://forums.phpfreaks.com/topic/286068-dropdown-selection-not-being-added-to-table/ Share on other sites More sharing options...
ginerjm Posted February 9, 2014 Share Posted February 9, 2014 1 - what is a <name> tag? 2 - how about showing us how you are handling the country result? Link to comment https://forums.phpfreaks.com/topic/286068-dropdown-selection-not-being-added-to-table/#findComment-1468308 Share on other sites More sharing options...
fastsol Posted February 10, 2014 Share Posted February 10, 2014 Since you didn't provide more of the code I am taking a guess at this but are you sure you closed the <select> tag after the <option>s. Link to comment https://forums.phpfreaks.com/topic/286068-dropdown-selection-not-being-added-to-table/#findComment-1468341 Share on other sites More sharing options...
jazzman1 Posted February 10, 2014 Share Posted February 10, 2014 Quote When a User selects a country via a dropdown on a form, upon submission it should be added to the table. But it isn't. Do you know how functions work in programming? You need to call NewUser(). Link to comment https://forums.phpfreaks.com/topic/286068-dropdown-selection-not-being-added-to-table/#findComment-1468344 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.