Jump to content

[SOLVED] Cant get "country" to echo??


mikebyrne

Recommended Posts

I can see all my variables apart from the "country" and I've no idea why??

 

<?php
require_once("adminconnect.php");

$tbl_name="adminusers";

echo $_POST['name'];
echo $_POST['address'];
echo $_POST['address1'];
echo $_POST['address2'];
echo $_POST['address3'];
echo $_POST['county'];
echo $_POST['zip'];
echo $_POST['telephone'];
echo $_POST['motelephone'];
echo $_POST['password'];
echo $_POST['password2'];
echo $_POST['username'];
echo $_POST['email'];
echo $_POST['birthdate'];
echo $_POST['birthmonth'];
echo $_POST['birthyear'];
echo $_POST['country'];
echo $_POST['sex'];

$name = mysql_real_escape_string(trim($_POST['name']));
$address = mysql_real_escape_string(trim($_POST['address']));
$address1 = mysql_real_escape_string(trim($_POST['address1']));
$address2 = mysql_real_escape_string(trim($_POST['address2']));
$address3 = mysql_real_escape_string(trim($_POST['address3']));
$county = mysql_real_escape_string(trim($_POST['county']));
$zip = mysql_real_escape_string(trim($_POST['zip']));
$telephone = mysql_real_escape_string(trim($_POST['telephone']));
$motelephone = mysql_real_escape_string(trim($_POST['motelephone']));
$email = mysql_real_escape_string(trim($_POST['email']));
$password =mysql_real_escape_string(trim($_POST['password']));
$username = mysql_real_escape_string(trim($_POST['username']));

$user = mysql_real_escape_string(htmlspecialchars($_POST['username']));




$sql = "SELECT name FROM adminusers WHERE username ='$user'";
$result = mysql_query($sql) or die("Error in SQL: ".mysql_error());
$row = mysql_fetch_array($result);
$count = mysql_num_rows($result);

$test = $row['name'];


			if ($count > 0) { // username should only exist once.
			$valid=0;
			$style_username = "background-color:#FF5959";
			$error_username = "Error! The username " . $user . " already exists in the database.";
							}

			if ($password == "" || strlen($password)<7) {
                $valid=0;
                $style_password = "background-color:#FF5959";
                $error_password = "Theres a problems with your password?<br>";

        						}

$sql="INSERT INTO $tbl_name(name, address, address1, address2, address3, address4, county, zip, telephone, email, username, password, usertype)VALUES('$name', '$address', '$address1', '$address2','$address3', '$address4','$county' ,'$zip', '$telephone', '$email', '$username', '$password' , 1)";

mysql_query($sql) or die(mysql_error().'<br /> Query was:'.$sql);
?>

<form name = "form" method="POST" action="register.php">
<tr>
<td align="right" width="50%"><span class="t11br">*</span> Name:</td>

<td>
<input class="byp" type="text" name="name" size="30" maxlength="30" value="<?php $name; ?>">
</td>
</tr>
<tr>
<td align="right"><span class="t11br">*</span> Address line 1:</td>
<td>
<input class="byp" type="text" name="address" size="30" maxlength="30" value="<?php $address; ?>">
</td>

</tr>
<tr>
<td align="right">Address line 2:</td>
<td>
<input class="byp" type="text" name="address1" size="30" maxlength="30" value="<?php $address1; ?>">
</td>
</tr>
<tr>
<td align="right">Address line 3:</td>
<td>

<input class="byp" type="text" name="address2" size="30" maxlength="30" value="<?php $address2 ;?>">
</td>
</tr>
<tr>
<td align="right">Address line 4:</td>
<td>
<input class="byp" type="text" name="address3" size="30" maxlength="30" value="<?php $address3; ?>">
</td>
</tr>
<tr>

<td align="right"><span class="t11br">*</span> County / State:</td>
<td>
<input class="byp" type="text" name="county" size="30" maxlength="30" value="<?php $county; ?>">
</td>
</tr>
<tr>
<td align="right"><span class="t11br">*</span> Post/Zip Code:</td>
<td>

<input class="byp" type="text" name="zip" size="20" maxlength="20" value="<?php $zip; ?>">
</td>
</tr>
<tr>
<td align="right"><span class="t11br">*</span> Country:</td>
<td>
<select class="byp" name="country">

<option value="country" selected></option><option value="GB">United Kingdom</option><option value="US">United States of America</option><option value="AG">Antigua and Barbuda</option><option value="AR">Argentina</option><option value="AU">Australia</option><option value="AT">Austria</option><option value="BS">Bahamas</option><option value="BB">Barbados</option><option value="BE">Belgium</option><option value="BM">Bermuda</option><option value="CA">Canada</option><option value="KY">Cayman Islands</option><option value="TD">Chad</option><option value="CL">Chile</option><option value="CN">China</option><option value="CU">Cuba</option><option value="CY">Cyprus</option><option value="CZ">Czech Republic</option><option value="DK">Denmark</option><option value="EG">Egypt</option><option value="FK">Falkland Islands</option><option value="FO">Faroe Islands</option><option value="FI">Finland</option><option value="FR">France</option><option value="DE">Germany</option><option value="GI">Gibraltar</option><option value="GL">Greenland</option><option value="GD">Grenada</option><option value="VA">Holy See (Vatican City State)</option><option value="HK">Hong Kong</option><option value="IS">Iceland</option><option value="IN">India</option><option value="IE">Ireland</option><option value="IT">Italy</option><option value="JM">Jamaica</option><option value="JP">Japan</option><option value="JO">Jordan</option><option value="KE">Kenya</option><option value="KW">Kuwait</option><option value="LR">Liberia</option><option value="LI">Liechtenstein</option><option value="LU">Luxembourg</option><option value="MS">Montserrat</option><option value="MO">Macau</option><option value="MY">Malaysia</option><option value="MQ">Martinique</option><option value="MR">Mauritania</option><option value="MX">Mexico</option><option value="MC">Monaco</option><option value="NL">Netherlands</option><option value="AN">Netherlands Antilles</option><option value="NZ">New Zealand</option><option value="KP">North Korea</option><option value="NO">Norway</option><option value="OM">Oman</option><option value="PK">Pakistan</option><option value="PA">Panama</option><option value="PY">Paraguay</option><option value="PH">Philippines</option><option value="PL">Poland</option><option value="PT">Portugal</option><option value="PR">Puerto Rico</option><option value="SH">Saint Helena</option><option value="KN">Saint Kitts and Nevis</option><option value="LC">Saint Lucia</option><option value="PM">Saint Pierre and Miquelon</option><option value="VC">Saint Vincent and the Grenadin</option><option value="SM">San Marino</option><option value="SC">Seychelles</option><option value="SG">Singapore</option><option value="ZA">South Africa</option><option value="KR">South Korea</option><option value="ES">Spain</option><option value="LK">Sri Lanka</option><option value="SE">Sweden</option><option value="CH">Switzerland</option><option value="TW">Taiwan</option><option value="TH">Thailand</option><option value="TT">Trinidad and Tobago</option><option value="TN">Tunisia</option><option value="TR">Turkey</option><option value="TC">Turks and Caicos Islands</option><option value="UM">United States Minor Outlying I</option><option value="UY">Uruguay</option><option value="VE">Venezuela</option><option value="VN">Vietnam</option><option value="VG">Virgin Islands (British)</option><option value="VI">Virgin Islands (US)</option>	</select>

</td>
</tr>
<tr>
<td align="right"><span class="t11br">*</span> Contact Telephone no:</td>
<td>
<input class="byp" type="text" name="telephone" size="30" maxlength="30" value="<?php $telephone; ?>">
</td>
</tr>
<tr>
<td align="right">Mobile Telephone no:</td>

<td>
<input class="byp" type="text" name="mobile" size="30" maxlength="30" value="<?php $motelephone; ?>">
</td>
</tr>
<tr>
<td align="right"><span class="t11br">*</span> Birthdate:</td>
<td>
<select class="byp" name="birthdate">
<option value="<?php $birthdate; ?>">

<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>

<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>

<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>

<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
</select>
<select class="byp" name="birthmonth">
<option value="" selected ></option>
<option value="1">January</option>
<option value="2">Febuary</option>

<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>

<option value="12">December</option>
</select>
<input class="byp" type="text" name="birthyear" size="4" maxlength="4" value="<?php $birthday; ?>">
<br>
(Year Optional eg. 1977 not 77)
</td>
</tr>
<tr>
<td align="right">I am:</td>
<td>
<select class="byp" name="sex">

<option value="sex"></option>
<option value="M">A gentleman</option>
<option value="F">A lady</option>
</select>
</td>
</tr>

<tr>
    <td colspan="2"><img src="http://images-cache.cd-wow.com/images/bluepix.gif" width="100%" height="1"></td>
</tr>
<tr>
<td colspan="2" class="genericside><span class="t11bw">Your email address and password will be used to logon as a WOW! Member.</span></td>

</tr>
<tr>
<td align="right"><span class="t11br">*</span> Email Address: (this will also be used as your username)</td>
<td>
<input class="byp" type="text" name="email" size="30" maxlength="50" value="<?php $email;?>">
</td>
</tr>
<tr>
<td align="right"><span class="t11br">*</span> Password: (must be at least 5 characters long)</td>

<td>
<input class="byp" type="password" name="password" size="20" maxlength="20" value="<?php $password;?>">
</td>
</tr>
<tr>
<td align="right"><span class="t11br">*</span> Password Retyped: (To ensure correct typed entry)</td>
<td>
<input class="byp" type="password" name="password2" size="20" maxlength="20" value="<?php $password2;?>">
</td>

</tr>
<tr>
<td colspan="2"><input type="hidden" name="register" value="true"></td>
</tr>
<tr>
    <td colspan="2"><img src="http://images-cache.cd-wow.com/images/bluepix.gif" width="100%" height="1"></td>
</tr>
<tr><td> </td>
<td><input type="submit" type="submit" value="Sign Me Up! »"></td>
</tr>
</form>

Link to comment
Share on other sites

The sql is from a previous form and I'll tidy that up once I can get the variables working. Another problem I have is if I submit the form when all the fields are blank I get "countrysex" displayed!! lol

 

Why are these two getting displayed when the fields are blank??

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.