Jump to content

Dropdown Selection not Being Added to Table


The_Thorn

Recommended Posts

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.*

Edited by The_Thorn
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.