Jump to content

Form Won't POST?


BradD

Recommended Posts

Hey Guys:

 

I just want to let you all know that I do put time into trying to figure these problems out before I post, because I know my level of experience stands out like "rovers family jewels"

 

I know that the ereg_replace needs to be changed and the filtering needs to be sorted and I will be getting onto that as soon as I can get this form to _POST info to the database. Thanks for pointing these issues out Thorpe.

 

So far, I have checked that I am able to INSERT directly to the DB and this works, data is imputing.

<?php 
require_once('connectDB.php');
mysql_query ("INSERT INTO members (firstname, lastname, username, password, email, country, state, city)
							  VALUES('John','Smith','Johnno','123456','john@abc.com','australia','queensland','brisbane')") or die(mysql_error());

?>

 

But something in the code below is not correct and I cant figure out what it is? I spent the entire day yesterday and all of this morning  "apart from watching 30 Years Of Origin and J Wincup have another win in the Holden 'yesterday'" :D reading, searching, looking for an answer. But it continues to evade me?

 

Any help on this issue would be greatly appreciated.

 

<?php


// Set error message as upon arrival to page
$errorMsg = "";
// check to see if the form has previously been submitted 
if (isset($_POST['username'])){
//Connect to DB
require_once('connectDB.php');
// Filter the posted variables
$firstname = ereg_replace("[^A-Za-z0-9]", "", $_POST['firstname']); // up arrow filters everything but letters and numbers without up arrow will filter all letters and numbers
$lastname = ereg_replace("[^A-Za-z0-9]", "", $_POST['lastname']); // ^ filters everything but letters and numbers
$username = ereg_replace("[^A-Za-z0-9]", "", $_POST['username']); // ^ filters everything but numbers and letters
$password = ereg_replace("[^A-Za-z0-9]", "", $_POST['password']); // filter everything but numbers and letters
$accounttype = ereg_replace("[^a-z]", "", $_POST['accounttype']);
$country = ereg_replace("[^A-Z a-z0-9]", "", $_POST['country']); // filter everything but spaces, numbers, and letters
$state = ereg_replace("[^A-Z a-z0-9]", "", $_POST['state']); // filter everything but spaces, numbers, and letters
$city = ereg_replace("[^A-Z a-z0-9]", "", $_POST['city']); // filter everything but spaces, numbers, and letters there is a space here allowing spaces
$phone = ereg_replace("[^A-Za-z0-9]", "", $_POST['phone']); // not sure what to filter will have to experiment 
$mobile = ereg_replace("[^A-Za-z0-9]", "", $_POST['mobile']);
$business = ereg_replace("[^A-Za-z0-9]", "", $_POST['business']);
$email = stripslashes($_POST['email']);
$email = strip_tags($email);
$email = mysql_real_escape_string($email);
$website = ereg_replace("[^A-Za-z0-9]", "", $_POST['website']); // also not sure what to filter will need to test 
// Check to see if the user filled all fields with
// the "Required"(*) symbol next to them in the join form
// and print out to them what they have forgotten to put in
if((!$firstname) || (!$lastname) || (!$username)  || (!$password) || (!$email) || (!$accounttype) || (!$country) || (!$state) || (!$city) ){

	$errorMsg = "You did not submit the following required information!<br /><br />";
	if(!$firstname){
		$errorMsg .= "--- First Name";
	} else if(!$lastname){
		$errorMsg .= "--- Last Name";
    } else if(!$username){
		$errorMsg .= "--- UserName";
	} else if(!$password){
		$errorMsg .= "--- Password";
	} else if(!$accounttype){
		$errorMsg .= "--- Account Type";
	} else if(!$country){
		$errorMsg .= "--- Country"; 
	} else if(!$state){ 
	    $errorMsg .= "--- State"; 
    } else if(!$city){ 
        $errorMsg .= "--- City"; 
	} else if(!$email){
		$errorMsg .= "--- Email"; 
} else {
// Database duplicate Fields Check
$sql_username_check = mysql_query("SELECT id FROM members WHERE username='$username' LIMIT 1"); // mysql gives: $sql = "SELECT * FROM `members` LIMIT 0, 30 ";
$sql_email_check = mysql_query("SELECT id FROM members WHERE email='$email' LIMIT 1");
$username_check = mysql_num_rows($sql_username_check);
$email_check = mysql_num_rows($sql_email_check); 
if ($username_check > 0){ 
	$errorMsg = "<u>ERROR:</u><br />Your User Name is already in use inside our system. Please try another.";
} else if ($email_check > 0){ 
	$errorMsg = "<u>ERROR:</u><br />Your Email address is already in use inside our system. Please try another.";
} else {
	// Add MD5 Hash to the password variable
       $hashedPass = md5($password); 
	// Add user info into the database table, claim your fields then values 
	$sql = mysql_query("INSERT INTO members (firstname, lastname, username, password, country, state, city, accounttype, emailactivated, signupdate, phone, mobile, business, email, website, signupdate, emailactivated, lastlogin) 
	                    VALUES('$firstname','$lastname','$username','$password','$accounttype','$country','$state','$city','$phone','$mobile','$business','$email','$hashedPass','$website',        'signupdate','emailactivated','lastlogin', now())") or die (mysql_error());
	// Get the inserted ID here to use in the activation email, 
	$id = mysql_insert_id();
	// Create directory(folder) to hold each user files(pics, MP3s, etc.) 
	mkdir("memberFiles/$id", 0755); 
	// Start assembly of Email Member the activation link
	$to = "$email";
	// Change this to your site admin email
	$from = "brad@mlmnetworkingsystem.com";

	$subject = "Complete your registration";
	//Begin HTML Email Message where you need to change the activation URL inside
	$message = '<html>
	<body bgcolor="#FFFFFF">
	Hi ' . $username . ',
	<br /><br />
	Confirm your registration.
	<br /><br />
	Please click here to activate now >>
	<a href="http://www.mlmnetworkingsystem.com/activation.php?id=' . $id . '">
	ACTIVATE NOW</a>
	<br /><br />
	Your Login Data is as follows: 
	<br /><br />
	E-mail Address: ' . $email . ' <br />
	Password: ' . $password . ' 
	<br /><br /> 
	Thanks! 
	</body>
	</html>';
	// end of message
	$headers = "From: $from\r\n"; // \r opens database read only and \n creates new database truncate old versions if they exist
	$headers .= "Content-type: text/html\r\n";
	$to = "$to";
	// Finally send the activation email to the member
	mail($to, $subject, $message, $headers);
	// Then print a message to the browser for the joiner 
	print "<br /><br /><br /><h4>OK $firstname, one last step to verify your email identity:</h4><br />
	We just sent an Activation link to: $email<br /><br />
	<strong><font color=\"#990000\">Please check your email inbox in a moment</font></strong> to click on the Activation <br />
	Link inside the message. After email activation you can log in.";
	exit(); // Exit so the form and page does not display, just this success message
} // Close else after database duplicate field value checks
  } // Close else after missing vars check
} //Close if $_POST
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Registration</title>
</head>
<body>
  <table width="528" align="center" cellpadding= "4">
  <tr>
  <td width= = "7%">REGISTER AS A MEMBER BELOW </td>
  </tr>
  </table>
  <table width= "528" align= "center" cellpadding= "5">
    <form action="jointoday.php" method="post" enctype="multipart/form-data">
     <tr>
      <td colspan="2"><font color="#FF0000"><?php echo "$errorMsg"; ?></font></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">First Name:</td>
      <td><input name="firstname" type="text" value="<?php echo "$firstname"; ?>" size="40" maxlength="40" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Last Name:</td>
      <td><input name="lastname" type="text" value="<?php echo "$lastname"; ?>" size="40" maxlength="40" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Username:</td>
      <td><input name="username" type="text" value="<?php echo "$username"; ?>" size="40" maxlength="40" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Password:</td>
      <td><input name="password" type="text" value="<?php echo "$password"; ?>" size="32" maxlength="32" /></td>
    </tr>
     <tr valign="baseline">
      <td align="right">Account Type:</td>
      <td><select name="accounttype">
        <option value="<?php echo "$accounttype"; ?>"><?php echo "$accounttype"; ?></option>
        <option value="a">Normal User</option>
        <option value="b">Expert User</option>
        <option value="c">Super User</option>
      </select></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Country:</td>
      <td>
        <select name="country" size="1" id="Country">
<option value="<?php echo "$country"; ?>"><?php echo "$country"; ?></option>        
<option value="select a country" selected>(please select a country)</option>
<option value="none">none</option>
<option value="AF">Afghanistan</option>
<option value="AL">Albania</option>
<option value="DZ">Algeria</option>
<option value="AS">American Samoa</option>
<option value="AD">Andorra</option>
<option value="AO">Angola</option>
<option value="AI">Anguilla</option>
<option value="AQ">Antarctica</option>
<option value="AG">Antigua and Barbuda</option>
<option value="AR">Argentina</option>
<option value="AM">Armenia</option>
<option value="AW">Aruba</option>
<option value="AU">Australia</option>
<option value="AT">Austria</option>
<option value="AZ">Azerbaijan</option>
<option value="BS">Bahamas</option>
<option value="BH">Bahrain</option>
<option value="BD">Bangladesh</option>
<option value="BB">Barbados</option>
<option value="BY">Belarus</option>
<option value="BE">Belgium</option>
<option value="BZ">Belize</option>
<option value="BJ">Benin</option>
<option value="BM">Bermuda</option>
<option value="BT">Bhutan</option>
<option value="BO">Bolivia</option>
<option value="BA">Bosnia and Herzegowina</option>
<option value="BW">Botswana</option>
<option value="BV">Bouvet Island</option>
<option value="BR">Brazil</option>
<option value="IO">British Indian Ocean Territory</option>
<option value="BN">Brunei Darussalam</option>
<option value="BG">Bulgaria</option>
<option value="BF">Burkina Faso</option>
<option value="BI">Burundi</option>
<option value="KH">Cambodia</option>
<option value="CM">Cameroon</option>
<option value="CA">Canada</option>
<option value="CV">Cape Verde</option>
<option value="KY">Cayman Islands</option>
<option value="CF">Central African Republic</option>
<option value="TD">Chad</option>
<option value="CL">Chile</option>
<option value="CN">China</option>
<option value="CX">Christmas Island</option>
<option value="CC">Cocos (Keeling) Islands</option>
<option value="CO">Colombia</option>
<option value="KM">Comoros</option>
<option value="CG">Congo</option>
<option value="CD">Congo, the Democratic Republic of the</option>
<option value="CK">Cook Islands</option>
<option value="CR">Costa Rica</option>
<option value="CI">Cote d'Ivoire</option>
<option value="HR">Croatia (Hrvatska)</option>
<option value="CU">Cuba</option>
<option value="CY">Cyprus</option>
<option value="CZ">Czech Republic</option>
<option value="DK">Denmark</option>
<option value="DJ">Djibouti</option>
<option value="DM">Dominica</option>
<option value="DO">Dominican Republic</option>
<option value="TP">East Timor</option>
<option value="EC">Ecuador</option>
<option value="EG">Egypt</option>
<option value="SV">El Salvador</option>
<option value="GQ">Equatorial Guinea</option>
<option value="ER">Eritrea</option>
<option value="EE">Estonia</option>
<option value="ET">Ethiopia</option>
<option value="FK">Falkland Islands (Malvinas)</option>
<option value="FO">Faroe Islands</option>
<option value="FJ">Fiji</option>
<option value="FI">Finland</option>
<option value="FR">France</option>
<option value="FX">France, Metropolitan</option>
<option value="GF">French Guiana</option>
<option value="PF">French Polynesia</option>
<option value="TF">French Southern Territories</option>
<option value="GA">Gabon</option>
<option value="GM">Gambia</option>
<option value="GE">Georgia</option>
<option value="DE">Germany</option>
<option value="GH">Ghana</option>
<option value="GI">Gibraltar</option>
<option value="GR">Greece</option>
<option value="GL">Greenland</option>
<option value="GD">Grenada</option>
<option value="GP">Guadeloupe</option>
<option value="GU">Guam</option>
<option value="GT">Guatemala</option>
<option value="GN">Guinea</option>
<option value="GW">Guinea-Bissau</option>
<option value="GY">Guyana</option>
<option value="HT">Haiti</option>
<option value="HM">Heard and Mc Donald Islands</option>
<option value="VA">Holy See (Vatican City State)</option>
<option value="HN">Honduras</option>
<option value="HK">Hong Kong</option>
<option value="HU">Hungary</option>
<option value="IS">Iceland</option>
<option value="IN">India</option>
<option value="ID">Indonesia</option>
<option value="IR">Iran (Islamic Republic of)</option>
<option value="IQ">Iraq</option>
<option value="IE">Ireland</option>
<option value="IL">Israel</option>
<option value="IT">Italy</option>
<option value="JM">Jamaica</option>
<option value="JP">Japan</option>
<option value="JO">Jordan</option>
<option value="KZ">Kazakhstan</option>
<option value="KE">Kenya</option>
<option value="KI">Kiribati</option>
<option value="KP">Korea, Democratic People's Republic of</option>
<option value="KR">Korea, Republic of</option>
<option value="KW">Kuwait</option>
<option value="KG">Kyrgyzstan</option>
<option value="LA">Lao People's Democratic Republic</option>
<option value="LV">Latvia</option>
<option value="LB">Lebanon</option>
<option value="LS">Lesotho</option>
<option value="LR">Liberia</option>
<option value="LY">Libyan Arab Jamahiriya</option>
<option value="LI">Liechtenstein</option>
<option value="LT">Lithuania</option>
<option value="LU">Luxembourg</option>
<option value="MO">Macau</option>
<option value="MK">Macedonia, The Former Yugoslav Republic of</option>
<option value="MG">Madagascar</option>
<option value="MW">Malawi</option>
<option value="MY">Malaysia</option>
<option value="MV">Maldives</option>
<option value="ML">Mali</option>
<option value="MT">Malta</option>
<option value="MH">Marshall Islands</option>
<option value="MQ">Martinique</option>
<option value="MR">Mauritania</option>
<option value="MU">Mauritius</option>
<option value="YT">Mayotte</option>
<option value="MX">Mexico</option>
<option value="FM">Micronesia, Federated States of</option>
<option value="MD">Moldova, Republic of</option>
<option value="MC">Monaco</option>
<option value="MN">Mongolia</option>
<option value="MS">Montserrat</option>
<option value="MA">Morocco</option>
<option value="MZ">Mozambique</option>
<option value="MM">Myanmar</option>
<option value="NA">Namibia</option>
<option value="NR">Nauru</option>
<option value="NP">Nepal</option>
<option value="NL">Netherlands</option>
<option value="AN">Netherlands Antilles</option>
<option value="NC">New Caledonia</option>
<option value="NZ">New Zealand</option>
<option value="NI">Nicaragua</option>
<option value="NE">Niger</option>
<option value="NG">Nigeria</option>
<option value="NU">Niue</option>
<option value="NF">Norfolk Island</option>
<option value="MP">Northern Mariana Islands</option>
<option value="NO">Norway</option>
<option value="OM">Oman</option>
<option value="PK">Pakistan</option>
<option value="PW">Palau</option>
<option value="PA">Panama</option>
<option value="PG">Papua New Guinea</option>
<option value="PY">Paraguay</option>
<option value="PE">Peru</option>
<option value="PH">Philippines</option>
<option value="PN">Pitcairn</option>
<option value="PL">Poland</option>
<option value="PT">Portugal</option>
<option value="PR">Puerto Rico</option>
<option value="QA">Qatar</option>
<option value="RE">Reunion</option>
<option value="RO">Romania</option>
<option value="RU">Russian Federation</option>
<option value="RW">Rwanda</option>
<option value="KN">Saint Kitts and Nevis</option>
<option value="LC">Saint LUCIA</option>
<option value="VC">Saint Vincent and the Grenadines</option>
<option value="WS">Samoa</option>
<option value="SM">San Marino</option>
<option value="ST">Sao Tome and Principe</option>
<option value="SA">Saudi Arabia</option>
<option value="SN">Senegal</option>
<option value="SC">Seychelles</option>
<option value="SL">Sierra Leone</option>
<option value="SG">Singapore</option>
<option value="SK">Slovakia (Slovak Republic)</option>
<option value="SI">Slovenia</option>
<option value="SB">Solomon Islands</option>
<option value="SO">Somalia</option>
<option value="ZA">South Africa</option>
<option value="GS">South Georgia and the South Sandwich Islands</option>
<option value="ES">Spain</option>
<option value="LK">Sri Lanka</option>
<option value="SH">St. Helena</option>
<option value="PM">St. Pierre and Miquelon</option>
<option value="SD">Sudan</option>
<option value="SR">Suriname</option>
<option value="SJ">Svalbard and Jan Mayen Islands</option>
<option value="SZ">Swaziland</option>
<option value="SE">Sweden</option>
<option value="CH">Switzerland</option>
<option value="SY">Syrian Arab Republic</option>
<option value="TW">Taiwan, Province of China</option>
<option value="TJ">Tajikistan</option>
<option value="TZ">Tanzania, United Republic of</option>
<option value="TH">Thailand</option>
<option value="TG">Togo</option>
<option value="TK">Tokelau</option>
<option value="TO">Tonga</option>
<option value="TT">Trinidad and Tobago</option>
<option value="TN">Tunisia</option>
<option value="TR">Turkey</option>
<option value="TM">Turkmenistan</option>
<option value="TC">Turks and Caicos Islands</option>
<option value="TV">Tuvalu</option>
<option value="UG">Uganda</option>
<option value="UA">Ukraine</option>
<option value="AE">United Arab Emirates</option>
<option value="GB">United Kingdom</option>
<option value="US">United States</option>
<option value="UM">United States Minor Outlying Islands</option>
<option value="UY">Uruguay</option>
<option value="UZ">Uzbekistan</option>
<option value="VU">Vanuatu</option>
<option value="VE">Venezuela</option>
<option value="VN">Viet Nam</option>
<option value="VG">Virgin Islands (British)</option>
<option value="VI">Virgin Islands (U.S.)</option>
<option value="WF">Wallis and Futuna Islands</option>
<option value="EH">Western Sahara</option>
<option value="YE">Yemen</option>
<option value="YU">Yugoslavia</option>
<option value="ZM">Zambia</option>
<option value="ZW">Zimbabwe</option>
        </select></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">State:</td>
      <td><input type="text" name="state" value="<?php echo "$state"; ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">City:</td>
      <td><input type="text" name="city" value="<?php echo "$city"; ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Phone:</td>
      <td><input type="text" name="phone" value="<?php echo "$phone"; ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Mobile:</td>
      <td><input type="text" name="mobile" value="<?php echo "$mobile"; ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Business:</td>
      <td><input type="text" name="business" value="<?php echo "$business"; ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Email:</td>
      <td><input type="text" name="email" value="<?php echo "$email"; ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Website:</td>
      <td><input type="text" name="website" value="<?php echo "$website"; ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right"> </td>
      <td><input type="submit" name="submit" value="Register" /></td>
    </tr>
      </form>
  </table>
<p> </p>
</body>
</html>

 

 

Link to comment
Share on other sites

I'd start with some basic debugging, such as looping through and echoing the $_POST array to make sure all the data is there, and all the keys are spelled properly, etc, Then echo the query string(s), and add the hateful "or die(mysql_error())" to the queries. Then you can echo all the validated variables, checking them for irregularities. Also, check your PHP and MySQL error logs.

Link to comment
Share on other sites

I'd start with some basic debugging, such as looping through and echoing the $_POST array to make sure all the data is there, and all the keys are spelled properly, etc, Then echo the query string(s), and add the hateful "or die(mysql_error())" to the queries. Then you can echo all the validated variables, checking them for irregularities. Also, check your PHP and MySQL error logs.

 

Thanks Pikachu: Kratsg would be appalled with me, he told me to add error_reporting (E_ALL); the other day and I did, but then I removed it temporarily because I wanted to test something without it being there, then due to information overload I forgot to put it back, "Sorry Kratsg!" It's back now and yes I know what your thinking...

 

OK now I have put it back now I'm getting <br /> <b>Notice</b>:  Undefined variable: firstname in <b>/home/database/public_html/jointoday.php</b> on line <b>all form fields</b><br />

 

 

 

"I'm gunna be an old man before I get this form to work"

Link to comment
Share on other sites

I'd start with some basic debugging, such as looping through and echoing the $_POST array to make sure all the data is there, and all the keys are spelled properly, etc, Then echo the query string(s), and add the hateful "or die(mysql_error())" to the queries. Then you can echo all the validated variables, checking them for irregularities. Also, check your PHP and MySQL error logs.

 

Alrightythen! I have made some changes changed out ereg_replace and replaced it with mysql_real_escape_string but still can't figure out why I'm getting the error notice:

 

Notice Undefined variable: firstname

                                          lastname

                                          username

                                          password in /home/unclebob/public_html/jointoday.php

 

This error message is in all form fields and I'm pretty sure the problem stems back to the /home/unclebob/public thing... because the database is unclebob_unclebobrocks

 

And I'm pretty sure that the variables have been defined in

$firstname = mysql_real_escape_string ($_POST['firstname']); //mysql_real_escape_string  — Escapes special characters in a string for use in an SQL statement
$lastname = mysql_real_escape_string ($_POST['lastname']); 
$username = mysql_real_escape_string ($_POST['username']); 
$password = mysql_real_escape_string ($_POST['password']); 
$accounttype = mysql_real_escape_string ($_POST['accounttype']);
$country = mysql_real_escape_string ($_POST['country']); 
$state = mysql_real_escape_string ($_POST['state']); 
$city = mysql_real_escape_string ($_POST['city']); 
$phone = mysql_real_escape_string ($_POST['phone']); 
$mobile = mysql_real_escape_string ($_POST['mobile']);
$business = mysql_real_escape_string ($_POST['business']);
$email = stripslashes($_POST['email']);
$email = strip_tags($email);
$email = mysql_real_escape_string($email);
$website = mysql_real_escape_string ($_POST['website']); 

 

and I'm still trying to figure out JUST HOW to loop and echo the $_POST array and query strings correctly

 

Any Ideas Anyone?

Link to comment
Share on other sites

What is the flow of the process in which this form is used? Is the first form the user fills out, or is another form submission required before arriving at this one?

 

Hey Pikachu: It's intended to be the first form the user fills out.

 

I decided to go all the way back to basics and stripped all the unnecessary code out to see what would happen and it the result was SUCCESS, I actually got some data inserted to mysql. I kept thinking it was a database select or connect issue, don't know why I thought that? Probably because I was completely out of any other ideas! But at least now I know that's not the problem and I can move forward with a clearer picture.

 

Now it's just a case of figuring out what it was that was stopping the process.

Below is what I stripped back to, it's really the absolute bare minimum.

<?php


// Set error message as upon arrival to page
$errorMsg = "";
// First we check to see if the form has previously been submitted 

//Connect to DB
include_once('connectDB.php');

// Filter the posted variables
$firstname = $_POST['firstname']; //mysql_real_escape_string  — 
$lastname = $_POST['lastname']; 
$username = $_POST['username']; 
$password = $_POST['password']; 
$accounttype = $_POST['accounttype'];
$country = $_POST['country']; 
$state = $_POST['state']; 
$city = $_POST['city']; 
$phone = $_POST['phone']; 
$mobile = $_POST['mobile'];
$business = $_POST['business'];
$email = $_POST['email'];
$website = $_POST['website']; 


	// Add user info into the database table, claim your fields then values 
	$sql = mysql_query("INSERT INTO members (firstname, lastname, username, password, country, state, city, accounttype, phone, mobile, business, email, website)
											 VALUES('$firstname','$lastname','$username','$password','$country','$state','$city','$accounttype','$phone','$mobile','$business','$email','$website')") or die(mysql_error()); 
	?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Registration</title>
</head>
<body>
  <table width="528" align="center" cellpadding= "4">
  <tr>
  <td width= = "7%">REGISTER AS A MEMBER BELOW </td>
  </tr>
  </table>
  <table width= "528" align= "center" cellpadding= "5">
    <form action="jointoday.php" method="post" enctype="multipart/form-data">
     <tr>
      <td colspan="2"><font color="#FF0000"><?php echo "$errorMsg"; ?></font></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">First Name:</td>
      <td><input name="firstname" type="text" value="<?php echo "$firstname"; ?>" size="40" maxlength="40" /></td> 
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Last Name:</td>
      <td><input name="lastname" type="text" value="<?php echo "$lastname"; ?>" size="40" maxlength="40" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Username:</td>
      <td><input name="username" type="text" value="<?php echo "$username"; ?>" size="40" maxlength="40" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Password:</td>
      <td><input name="password" type="text" value="<?php echo "$password"; ?>" size="32" maxlength="32" /></td>
    </tr>
     <tr valign="baseline">
      <td align="right">Account Type:</td>
      <td><select name="accounttype">
        <option value="<?php echo "$accounttype"; ?>"><?php echo "$accounttype"; ?></option>
        <option value="a">Normal User</option>
        <option value="b">Expert User</option>
        <option value="c">Super User</option>
      </select></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Country:</td>
      <td>
        <select name="country" size="1" id="Country">
<option value="<?php echo "$country"; ?>"><?php echo "$country"; ?></option>        
<option value="select a country" selected>(please select a country)</option>
<option value="none">none</option>
<option value="AF">Afghanistan</option>
<option value="AL">Albania</option>
<option value="DZ">Algeria</option>
<option value="AS">American Samoa</option>
<option value="AD">Andorra</option>
<option value="AO">Angola</option>
<option value="AI">Anguilla</option>
<option value="AQ">Antarctica</option>
<option value="AG">Antigua and Barbuda</option>
<option value="AR">Argentina</option>
<option value="AM">Armenia</option>
<option value="AW">Aruba</option>
<option value="AU">Australia</option>
<option value="AT">Austria</option>
<option value="AZ">Azerbaijan</option>
<option value="BS">Bahamas</option>
<option value="BH">Bahrain</option>
<option value="BD">Bangladesh</option>
<option value="BB">Barbados</option>
<option value="BY">Belarus</option>
<option value="BE">Belgium</option>
<option value="BZ">Belize</option>
<option value="BJ">Benin</option>
<option value="BM">Bermuda</option>
<option value="BT">Bhutan</option>
<option value="BO">Bolivia</option>
<option value="BA">Bosnia and Herzegowina</option>
<option value="BW">Botswana</option>
<option value="BV">Bouvet Island</option>
<option value="BR">Brazil</option>
<option value="IO">British Indian Ocean Territory</option>
<option value="BN">Brunei Darussalam</option>
<option value="BG">Bulgaria</option>
<option value="BF">Burkina Faso</option>
<option value="BI">Burundi</option>
<option value="KH">Cambodia</option>
<option value="CM">Cameroon</option>
<option value="CA">Canada</option>
<option value="CV">Cape Verde</option>
<option value="KY">Cayman Islands</option>
<option value="CF">Central African Republic</option>
<option value="TD">Chad</option>
<option value="CL">Chile</option>
<option value="CN">China</option>
<option value="CX">Christmas Island</option>
<option value="CC">Cocos (Keeling) Islands</option>
<option value="CO">Colombia</option>
<option value="KM">Comoros</option>
<option value="CG">Congo</option>
<option value="CD">Congo, the Democratic Republic of the</option>
<option value="CK">Cook Islands</option>
<option value="CR">Costa Rica</option>
<option value="CI">Cote d'Ivoire</option>
<option value="HR">Croatia (Hrvatska)</option>
<option value="CU">Cuba</option>
<option value="CY">Cyprus</option>
<option value="CZ">Czech Republic</option>
<option value="DK">Denmark</option>
<option value="DJ">Djibouti</option>
<option value="DM">Dominica</option>
<option value="DO">Dominican Republic</option>
<option value="TP">East Timor</option>
<option value="EC">Ecuador</option>
<option value="EG">Egypt</option>
<option value="SV">El Salvador</option>
<option value="GQ">Equatorial Guinea</option>
<option value="ER">Eritrea</option>
<option value="EE">Estonia</option>
<option value="ET">Ethiopia</option>
<option value="FK">Falkland Islands (Malvinas)</option>
<option value="FO">Faroe Islands</option>
<option value="FJ">Fiji</option>
<option value="FI">Finland</option>
<option value="FR">France</option>
<option value="FX">France, Metropolitan</option>
<option value="GF">French Guiana</option>
<option value="PF">French Polynesia</option>
<option value="TF">French Southern Territories</option>
<option value="GA">Gabon</option>
<option value="GM">Gambia</option>
<option value="GE">Georgia</option>
<option value="DE">Germany</option>
<option value="GH">Ghana</option>
<option value="GI">Gibraltar</option>
<option value="GR">Greece</option>
<option value="GL">Greenland</option>
<option value="GD">Grenada</option>
<option value="GP">Guadeloupe</option>
<option value="GU">Guam</option>
<option value="GT">Guatemala</option>
<option value="GN">Guinea</option>
<option value="GW">Guinea-Bissau</option>
<option value="GY">Guyana</option>
<option value="HT">Haiti</option>
<option value="HM">Heard and Mc Donald Islands</option>
<option value="VA">Holy See (Vatican City State)</option>
<option value="HN">Honduras</option>
<option value="HK">Hong Kong</option>
<option value="HU">Hungary</option>
<option value="IS">Iceland</option>
<option value="IN">India</option>
<option value="ID">Indonesia</option>
<option value="IR">Iran (Islamic Republic of)</option>
<option value="IQ">Iraq</option>
<option value="IE">Ireland</option>
<option value="IL">Israel</option>
<option value="IT">Italy</option>
<option value="JM">Jamaica</option>
<option value="JP">Japan</option>
<option value="JO">Jordan</option>
<option value="KZ">Kazakhstan</option>
<option value="KE">Kenya</option>
<option value="KI">Kiribati</option>
<option value="KP">Korea, Democratic People's Republic of</option>
<option value="KR">Korea, Republic of</option>
<option value="KW">Kuwait</option>
<option value="KG">Kyrgyzstan</option>
<option value="LA">Lao People's Democratic Republic</option>
<option value="LV">Latvia</option>
<option value="LB">Lebanon</option>
<option value="LS">Lesotho</option>
<option value="LR">Liberia</option>
<option value="LY">Libyan Arab Jamahiriya</option>
<option value="LI">Liechtenstein</option>
<option value="LT">Lithuania</option>
<option value="LU">Luxembourg</option>
<option value="MO">Macau</option>
<option value="MK">Macedonia, The Former Yugoslav Republic of</option>
<option value="MG">Madagascar</option>
<option value="MW">Malawi</option>
<option value="MY">Malaysia</option>
<option value="MV">Maldives</option>
<option value="ML">Mali</option>
<option value="MT">Malta</option>
<option value="MH">Marshall Islands</option>
<option value="MQ">Martinique</option>
<option value="MR">Mauritania</option>
<option value="MU">Mauritius</option>
<option value="YT">Mayotte</option>
<option value="MX">Mexico</option>
<option value="FM">Micronesia, Federated States of</option>
<option value="MD">Moldova, Republic of</option>
<option value="MC">Monaco</option>
<option value="MN">Mongolia</option>
<option value="MS">Montserrat</option>
<option value="MA">Morocco</option>
<option value="MZ">Mozambique</option>
<option value="MM">Myanmar</option>
<option value="NA">Namibia</option>
<option value="NR">Nauru</option>
<option value="NP">Nepal</option>
<option value="NL">Netherlands</option>
<option value="AN">Netherlands Antilles</option>
<option value="NC">New Caledonia</option>
<option value="NZ">New Zealand</option>
<option value="NI">Nicaragua</option>
<option value="NE">Niger</option>
<option value="NG">Nigeria</option>
<option value="NU">Niue</option>
<option value="NF">Norfolk Island</option>
<option value="MP">Northern Mariana Islands</option>
<option value="NO">Norway</option>
<option value="OM">Oman</option>
<option value="PK">Pakistan</option>
<option value="PW">Palau</option>
<option value="PA">Panama</option>
<option value="PG">Papua New Guinea</option>
<option value="PY">Paraguay</option>
<option value="PE">Peru</option>
<option value="PH">Philippines</option>
<option value="PN">Pitcairn</option>
<option value="PL">Poland</option>
<option value="PT">Portugal</option>
<option value="PR">Puerto Rico</option>
<option value="QA">Qatar</option>
<option value="RE">Reunion</option>
<option value="RO">Romania</option>
<option value="RU">Russian Federation</option>
<option value="RW">Rwanda</option>
<option value="KN">Saint Kitts and Nevis</option>
<option value="LC">Saint LUCIA</option>
<option value="VC">Saint Vincent and the Grenadines</option>
<option value="WS">Samoa</option>
<option value="SM">San Marino</option>
<option value="ST">Sao Tome and Principe</option>
<option value="SA">Saudi Arabia</option>
<option value="SN">Senegal</option>
<option value="SC">Seychelles</option>
<option value="SL">Sierra Leone</option>
<option value="SG">Singapore</option>
<option value="SK">Slovakia (Slovak Republic)</option>
<option value="SI">Slovenia</option>
<option value="SB">Solomon Islands</option>
<option value="SO">Somalia</option>
<option value="ZA">South Africa</option>
<option value="GS">South Georgia and the South Sandwich Islands</option>
<option value="ES">Spain</option>
<option value="LK">Sri Lanka</option>
<option value="SH">St. Helena</option>
<option value="PM">St. Pierre and Miquelon</option>
<option value="SD">Sudan</option>
<option value="SR">Suriname</option>
<option value="SJ">Svalbard and Jan Mayen Islands</option>
<option value="SZ">Swaziland</option>
<option value="SE">Sweden</option>
<option value="CH">Switzerland</option>
<option value="SY">Syrian Arab Republic</option>
<option value="TW">Taiwan, Province of China</option>
<option value="TJ">Tajikistan</option>
<option value="TZ">Tanzania, United Republic of</option>
<option value="TH">Thailand</option>
<option value="TG">Togo</option>
<option value="TK">Tokelau</option>
<option value="TO">Tonga</option>
<option value="TT">Trinidad and Tobago</option>
<option value="TN">Tunisia</option>
<option value="TR">Turkey</option>
<option value="TM">Turkmenistan</option>
<option value="TC">Turks and Caicos Islands</option>
<option value="TV">Tuvalu</option>
<option value="UG">Uganda</option>
<option value="UA">Ukraine</option>
<option value="AE">United Arab Emirates</option>
<option value="GB">United Kingdom</option>
<option value="US">United States</option>
<option value="UM">United States Minor Outlying Islands</option>
<option value="UY">Uruguay</option>
<option value="UZ">Uzbekistan</option>
<option value="VU">Vanuatu</option>
<option value="VE">Venezuela</option>
<option value="VN">Viet Nam</option>
<option value="VG">Virgin Islands (British)</option>
<option value="VI">Virgin Islands (U.S.)</option>
<option value="WF">Wallis and Futuna Islands</option>
<option value="EH">Western Sahara</option>
<option value="YE">Yemen</option>
<option value="YU">Yugoslavia</option>
<option value="ZM">Zambia</option>
<option value="ZW">Zimbabwe</option>
        </select></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">State:</td>
      <td><input type="text" name="state" value="<?php echo "$state"; ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">City:</td>
      <td><input type="text" name="city" value="<?php echo "$city"; ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Phone:</td>
      <td><input type="text" name="phone" value="<?php echo "$phone"; ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Mobile:</td>
      <td><input type="text" name="mobile" value="<?php echo "$mobile"; ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Business:</td>
      <td><input type="text" name="business" value="<?php echo "$business"; ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Email:</td>
      <td><input type="text" name="email" value="<?php echo "$email"; ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Website:</td>
      <td><input type="text" name="website" value="<?php echo "$website"; ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right"> </td>
      <td><input type="submit" name="submit" value="Register" /></td>
    </tr>
      </form>
  </table>
<p> </p>
</body>
</html>

Link to comment
Share on other sites

What is the flow of the process in which this form is used? Is the first form the user fills out, or is another form submission required before arriving at this one?

 

Hey Pikachu: It's intended to be the first form the user fills out.

 

I decided to go all the way back to basics and stripped all the unnecessary code out to see what would happen and it the result was SUCCESS, I actually got some data inserted to mysql. I kept thinking it was a database select or connect issue, don't know why I thought that? Probably because I was completely out of any other ideas! But at least now I know that's not the problem and I can move forward with a clearer picture.

 

Now it's just a case of figuring out what it was that was stopping the process.

Below is what I stripped back to, it's really the absolute bare minimum.

<?php


// Set error message as upon arrival to page
$errorMsg = "";
// First we check to see if the form has previously been submitted 

//Connect to DB
include_once('connectDB.php');

// Filter the posted variables
$firstname = $_POST['firstname']; //mysql_real_escape_string  — 
$lastname = $_POST['lastname']; 
$username = $_POST['username']; 
$password = $_POST['password']; 
$accounttype = $_POST['accounttype'];
$country = $_POST['country']; 
$state = $_POST['state']; 
$city = $_POST['city']; 
$phone = $_POST['phone']; 
$mobile = $_POST['mobile'];
$business = $_POST['business'];
$email = $_POST['email'];
$website = $_POST['website']; 


	// Add user info into the database table, claim your fields then values 
	$sql = mysql_query("INSERT INTO members (firstname, lastname, username, password, country, state, city, accounttype, phone, mobile, business, email, website)
											 VALUES('$firstname','$lastname','$username','$password','$country','$state','$city','$accounttype','$phone','$mobile','$business','$email','$website')") or die(mysql_error()); 
	?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Registration</title>
</head>
<body>
  <table width="528" align="center" cellpadding= "4">
  <tr>
  <td width= = "7%">REGISTER AS A MEMBER BELOW </td>
  </tr>
  </table>
  <table width= "528" align= "center" cellpadding= "5">
    <form action="jointoday.php" method="post" enctype="multipart/form-data">
     <tr>
      <td colspan="2"><font color="#FF0000"><?php echo "$errorMsg"; ?></font></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">First Name:</td>
      <td><input name="firstname" type="text" value="<?php echo "$firstname"; ?>" size="40" maxlength="40" /></td> 
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Last Name:</td>
      <td><input name="lastname" type="text" value="<?php echo "$lastname"; ?>" size="40" maxlength="40" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Username:</td>
      <td><input name="username" type="text" value="<?php echo "$username"; ?>" size="40" maxlength="40" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Password:</td>
      <td><input name="password" type="text" value="<?php echo "$password"; ?>" size="32" maxlength="32" /></td>
    </tr>
     <tr valign="baseline">
      <td align="right">Account Type:</td>
      <td><select name="accounttype">
        <option value="<?php echo "$accounttype"; ?>"><?php echo "$accounttype"; ?></option>
        <option value="a">Normal User</option>
        <option value="b">Expert User</option>
        <option value="c">Super User</option>
      </select></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Country:</td>
      <td>
        <select name="country" size="1" id="Country">
<option value="<?php echo "$country"; ?>"><?php echo "$country"; ?></option>        
<option value="select a country" selected>(please select a country)</option>
<option value="none">none</option>
<option value="AF">Afghanistan</option>
<option value="AL">Albania</option>
<option value="DZ">Algeria</option>
<option value="AS">American Samoa</option>
<option value="AD">Andorra</option>
<option value="AO">Angola</option>
<option value="AI">Anguilla</option>
<option value="AQ">Antarctica</option>
<option value="AG">Antigua and Barbuda</option>
<option value="AR">Argentina</option>
<option value="AM">Armenia</option>
<option value="AW">Aruba</option>
<option value="AU">Australia</option>
<option value="AT">Austria</option>
<option value="AZ">Azerbaijan</option>
<option value="BS">Bahamas</option>
<option value="BH">Bahrain</option>
<option value="BD">Bangladesh</option>
<option value="BB">Barbados</option>
<option value="BY">Belarus</option>
<option value="BE">Belgium</option>
<option value="BZ">Belize</option>
<option value="BJ">Benin</option>
<option value="BM">Bermuda</option>
<option value="BT">Bhutan</option>
<option value="BO">Bolivia</option>
<option value="BA">Bosnia and Herzegowina</option>
<option value="BW">Botswana</option>
<option value="BV">Bouvet Island</option>
<option value="BR">Brazil</option>
<option value="IO">British Indian Ocean Territory</option>
<option value="BN">Brunei Darussalam</option>
<option value="BG">Bulgaria</option>
<option value="BF">Burkina Faso</option>
<option value="BI">Burundi</option>
<option value="KH">Cambodia</option>
<option value="CM">Cameroon</option>
<option value="CA">Canada</option>
<option value="CV">Cape Verde</option>
<option value="KY">Cayman Islands</option>
<option value="CF">Central African Republic</option>
<option value="TD">Chad</option>
<option value="CL">Chile</option>
<option value="CN">China</option>
<option value="CX">Christmas Island</option>
<option value="CC">Cocos (Keeling) Islands</option>
<option value="CO">Colombia</option>
<option value="KM">Comoros</option>
<option value="CG">Congo</option>
<option value="CD">Congo, the Democratic Republic of the</option>
<option value="CK">Cook Islands</option>
<option value="CR">Costa Rica</option>
<option value="CI">Cote d'Ivoire</option>
<option value="HR">Croatia (Hrvatska)</option>
<option value="CU">Cuba</option>
<option value="CY">Cyprus</option>
<option value="CZ">Czech Republic</option>
<option value="DK">Denmark</option>
<option value="DJ">Djibouti</option>
<option value="DM">Dominica</option>
<option value="DO">Dominican Republic</option>
<option value="TP">East Timor</option>
<option value="EC">Ecuador</option>
<option value="EG">Egypt</option>
<option value="SV">El Salvador</option>
<option value="GQ">Equatorial Guinea</option>
<option value="ER">Eritrea</option>
<option value="EE">Estonia</option>
<option value="ET">Ethiopia</option>
<option value="FK">Falkland Islands (Malvinas)</option>
<option value="FO">Faroe Islands</option>
<option value="FJ">Fiji</option>
<option value="FI">Finland</option>
<option value="FR">France</option>
<option value="FX">France, Metropolitan</option>
<option value="GF">French Guiana</option>
<option value="PF">French Polynesia</option>
<option value="TF">French Southern Territories</option>
<option value="GA">Gabon</option>
<option value="GM">Gambia</option>
<option value="GE">Georgia</option>
<option value="DE">Germany</option>
<option value="GH">Ghana</option>
<option value="GI">Gibraltar</option>
<option value="GR">Greece</option>
<option value="GL">Greenland</option>
<option value="GD">Grenada</option>
<option value="GP">Guadeloupe</option>
<option value="GU">Guam</option>
<option value="GT">Guatemala</option>
<option value="GN">Guinea</option>
<option value="GW">Guinea-Bissau</option>
<option value="GY">Guyana</option>
<option value="HT">Haiti</option>
<option value="HM">Heard and Mc Donald Islands</option>
<option value="VA">Holy See (Vatican City State)</option>
<option value="HN">Honduras</option>
<option value="HK">Hong Kong</option>
<option value="HU">Hungary</option>
<option value="IS">Iceland</option>
<option value="IN">India</option>
<option value="ID">Indonesia</option>
<option value="IR">Iran (Islamic Republic of)</option>
<option value="IQ">Iraq</option>
<option value="IE">Ireland</option>
<option value="IL">Israel</option>
<option value="IT">Italy</option>
<option value="JM">Jamaica</option>
<option value="JP">Japan</option>
<option value="JO">Jordan</option>
<option value="KZ">Kazakhstan</option>
<option value="KE">Kenya</option>
<option value="KI">Kiribati</option>
<option value="KP">Korea, Democratic People's Republic of</option>
<option value="KR">Korea, Republic of</option>
<option value="KW">Kuwait</option>
<option value="KG">Kyrgyzstan</option>
<option value="LA">Lao People's Democratic Republic</option>
<option value="LV">Latvia</option>
<option value="LB">Lebanon</option>
<option value="LS">Lesotho</option>
<option value="LR">Liberia</option>
<option value="LY">Libyan Arab Jamahiriya</option>
<option value="LI">Liechtenstein</option>
<option value="LT">Lithuania</option>
<option value="LU">Luxembourg</option>
<option value="MO">Macau</option>
<option value="MK">Macedonia, The Former Yugoslav Republic of</option>
<option value="MG">Madagascar</option>
<option value="MW">Malawi</option>
<option value="MY">Malaysia</option>
<option value="MV">Maldives</option>
<option value="ML">Mali</option>
<option value="MT">Malta</option>
<option value="MH">Marshall Islands</option>
<option value="MQ">Martinique</option>
<option value="MR">Mauritania</option>
<option value="MU">Mauritius</option>
<option value="YT">Mayotte</option>
<option value="MX">Mexico</option>
<option value="FM">Micronesia, Federated States of</option>
<option value="MD">Moldova, Republic of</option>
<option value="MC">Monaco</option>
<option value="MN">Mongolia</option>
<option value="MS">Montserrat</option>
<option value="MA">Morocco</option>
<option value="MZ">Mozambique</option>
<option value="MM">Myanmar</option>
<option value="NA">Namibia</option>
<option value="NR">Nauru</option>
<option value="NP">Nepal</option>
<option value="NL">Netherlands</option>
<option value="AN">Netherlands Antilles</option>
<option value="NC">New Caledonia</option>
<option value="NZ">New Zealand</option>
<option value="NI">Nicaragua</option>
<option value="NE">Niger</option>
<option value="NG">Nigeria</option>
<option value="NU">Niue</option>
<option value="NF">Norfolk Island</option>
<option value="MP">Northern Mariana Islands</option>
<option value="NO">Norway</option>
<option value="OM">Oman</option>
<option value="PK">Pakistan</option>
<option value="PW">Palau</option>
<option value="PA">Panama</option>
<option value="PG">Papua New Guinea</option>
<option value="PY">Paraguay</option>
<option value="PE">Peru</option>
<option value="PH">Philippines</option>
<option value="PN">Pitcairn</option>
<option value="PL">Poland</option>
<option value="PT">Portugal</option>
<option value="PR">Puerto Rico</option>
<option value="QA">Qatar</option>
<option value="RE">Reunion</option>
<option value="RO">Romania</option>
<option value="RU">Russian Federation</option>
<option value="RW">Rwanda</option>
<option value="KN">Saint Kitts and Nevis</option>
<option value="LC">Saint LUCIA</option>
<option value="VC">Saint Vincent and the Grenadines</option>
<option value="WS">Samoa</option>
<option value="SM">San Marino</option>
<option value="ST">Sao Tome and Principe</option>
<option value="SA">Saudi Arabia</option>
<option value="SN">Senegal</option>
<option value="SC">Seychelles</option>
<option value="SL">Sierra Leone</option>
<option value="SG">Singapore</option>
<option value="SK">Slovakia (Slovak Republic)</option>
<option value="SI">Slovenia</option>
<option value="SB">Solomon Islands</option>
<option value="SO">Somalia</option>
<option value="ZA">South Africa</option>
<option value="GS">South Georgia and the South Sandwich Islands</option>
<option value="ES">Spain</option>
<option value="LK">Sri Lanka</option>
<option value="SH">St. Helena</option>
<option value="PM">St. Pierre and Miquelon</option>
<option value="SD">Sudan</option>
<option value="SR">Suriname</option>
<option value="SJ">Svalbard and Jan Mayen Islands</option>
<option value="SZ">Swaziland</option>
<option value="SE">Sweden</option>
<option value="CH">Switzerland</option>
<option value="SY">Syrian Arab Republic</option>
<option value="TW">Taiwan, Province of China</option>
<option value="TJ">Tajikistan</option>
<option value="TZ">Tanzania, United Republic of</option>
<option value="TH">Thailand</option>
<option value="TG">Togo</option>
<option value="TK">Tokelau</option>
<option value="TO">Tonga</option>
<option value="TT">Trinidad and Tobago</option>
<option value="TN">Tunisia</option>
<option value="TR">Turkey</option>
<option value="TM">Turkmenistan</option>
<option value="TC">Turks and Caicos Islands</option>
<option value="TV">Tuvalu</option>
<option value="UG">Uganda</option>
<option value="UA">Ukraine</option>
<option value="AE">United Arab Emirates</option>
<option value="GB">United Kingdom</option>
<option value="US">United States</option>
<option value="UM">United States Minor Outlying Islands</option>
<option value="UY">Uruguay</option>
<option value="UZ">Uzbekistan</option>
<option value="VU">Vanuatu</option>
<option value="VE">Venezuela</option>
<option value="VN">Viet Nam</option>
<option value="VG">Virgin Islands (British)</option>
<option value="VI">Virgin Islands (U.S.)</option>
<option value="WF">Wallis and Futuna Islands</option>
<option value="EH">Western Sahara</option>
<option value="YE">Yemen</option>
<option value="YU">Yugoslavia</option>
<option value="ZM">Zambia</option>
<option value="ZW">Zimbabwe</option>
        </select></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">State:</td>
      <td><input type="text" name="state" value="<?php echo "$state"; ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">City:</td>
      <td><input type="text" name="city" value="<?php echo "$city"; ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Phone:</td>
      <td><input type="text" name="phone" value="<?php echo "$phone"; ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Mobile:</td>
      <td><input type="text" name="mobile" value="<?php echo "$mobile"; ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Business:</td>
      <td><input type="text" name="business" value="<?php echo "$business"; ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Email:</td>
      <td><input type="text" name="email" value="<?php echo "$email"; ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right">Website:</td>
      <td><input type="text" name="website" value="<?php echo "$website"; ?>" size="32" /></td>
    </tr>
    <tr valign="baseline">
      <td nowrap="nowrap" align="right"> </td>
      <td><input type="submit" name="submit" value="Register" /></td>
    </tr>
      </form>
  </table>
<p> </p>
</body>
</html>

 

OK the $errorMsg works and it always did, but when I add the SELECT id From members WHERE username function it all seems to break down ???

Im pretty sure I hav e enough script here to get a result??? BUT I can't see where the problem is???

 

Any Ideas?

<?php


// Set error message as upon arrival to page
$errorMsg = "";
// First we check to see if the form has previously been submitted 

//Connect to DB
include_once('connectDB.php');

// Filter the posted variables
$firstname = $_POST['firstname']; //mysql_real_escape_string  — 
$lastname = $_POST['lastname']; 
$username = $_POST['username']; 
$password = $_POST['password']; 
$accounttype = $_POST['accounttype'];
$country = $_POST['country']; 
$state = $_POST['state']; 
$city = $_POST['city']; 
$phone = $_POST['phone']; 
$mobile = $_POST['mobile'];
$business = $_POST['business'];
$email = $_POST['email'];
$website = $_POST['website']; 

 // Check to see if the user filled all fields with
// the "Required"(*) symbol next to them in the join form
// and print out to them what they have forgotten to put in
if((!$firstname) || (!$lastname) || (!$username)  || (!$password) || (!$email) || (!$accounttype) || (!$country) || (!$state) || (!$city)){

	$errorMsg = "You did not submit the following required information!<br /><br />";
	if(!$firstname){
		$errorMsg .= "--- First Name";
	} else if(!$lastname){
		$errorMsg .= "--- Last Name";
    } else if(!$username){
		$errorMsg .= "--- UserName";
	} else if(!$password){
		$errorMsg .= "--- Password";
	} else if(!$accounttype){
		$errorMsg .= "--- Account Type";
	} else if(!$country){
		$errorMsg .= "--- Country"; 
	} else if(!$state){ 
	    $errorMsg .= "--- State"; 
    } else if(!$city){ 
        $errorMsg .= "--- City"; 
	} else if(!$email){
		$errorMsg .= "--- Email"; 
} else {
// Database duplicate Fields Check
$sql_username_check = mysql_query("SELECT id FROM members WHERE username='$username' LIMIT 1"); // mysql gives: $sql = "SELECT * FROM `members` LIMIT 0, 30 ";
$sql_email_check = mysql_query("SELECT id FROM `members` WHERE email='$email' LIMIT 1");
$username_check = mysql_num_rows($sql_username_check);
$email_check = mysql_num_rows($sql_email_check); 
if ($username_check > 0){ 
	$errorMsg = "<u>ERROR:</u><br />Your User Name is already in use inside our system. Please try another.";
} else if ($email_check > 0){ 
	$errorMsg = "<u>ERROR:</u><br />Your Email address is already in use inside our system. Please try another.";
} else { 

        // Add user info into the database table, claim your fields then values 
	$sql = mysql_query("INSERT INTO members (firstname, lastname, username, password, country, state, city, accounttype, phone, mobile, business, email, website)
											 VALUES('$firstname','$lastname','$username','$password','$country','$state','$city','$accounttype','$phone','$mobile','$business','$email','$website')") or die(mysql_error());
  }
 }
}

	?>

 

Link to comment
Share on other sites

What is supposed to happen at that point? All that is indicated by the code above would be a database insert if the email and username checks return no results. Is that not happening?

 

Yep, no data is making it to the database, the form fields error message works when you don't fill out all the necessary fields , but it all breaks down from there, when I strip out all the extra filtering code and go back to absolute minimum INSERT code, it will communicate with DB and add data to the table.

 

Ken told me to check "}" placement, but when I try making changes I get error messages ???

 

 

Link to comment
Share on other sites

More debugging. Check that your results are there, and in the range you'd expect. Then throw some echo statements in  the conditionals to exactly what is happening. Also, change the query string so the string is separate from the execution, This makes it possible to debug the query string and variables by echoing them, and using them in the error message.

 

$email_check = mysql_num_rows($sql_email_check); 
echo "Rows returned by \$email_check: " . $email_check . "<br />"; // Add this line *******************
echo "Rows returned by \$username_check: " . $username_check . "<br />"; // Add this line *********************
if ($username_check > 0){
                        echo "Makes it to if(username_check > 0)"; // Add this line *********************
		$errorMsg = "<u>ERROR:</u><br />Your User Name is already in use inside our system. Please try another.";
	} else if ($email_check > 0){
		echo "Makes it to 'else if(email_check > 0)"; // Add this line *******************
		$errorMsg = "<u>ERROR:</u><br />Your Email address is already in use inside our system. Please try another.";
	} else {
		echo "Makes it to DB insert else{} statement"; // Add this line *************************
		// Add user info into the database table, claim your fields then values
/* ***************** NOTE CHANGES TO QUERY STRUCTURE ********************* */
		$sql = "INSERT INTO members (firstname, lastname, username, password, country, state, city, accounttype, phone, mobile, business, email, website)
	VALUES ('$firstname','$lastname','$username','$password','$country','$state','$city','$accounttype','$phone','$mobile','$business','$email','$website')";
		mysql_query($sql) or die( "Query cratered with this string: " . $sql . "and produced this error: " . mysql_error() );

Link to comment
Share on other sites

More debugging. Check that your results are there, and in the range you'd expect. Then throw some echo statements in  the conditionals to exactly what is happening. Also, change the query string so the string is separate from the execution, This makes it possible to debug the query string and variables by echoing them, and using them in the error message.

 

$email_check = mysql_num_rows($sql_email_check); 
echo "Rows returned by \$email_check: " . $email_check . "<br />"; // Add this line *******************
echo "Rows returned by \$username_check: " . $username_check . "<br />"; // Add this line *********************
if ($username_check > 0){
                        echo "Makes it to if(username_check > 0)"; // Add this line *********************
		$errorMsg = "<u>ERROR:</u><br />Your User Name is already in use inside our system. Please try another.";
	} else if ($email_check > 0){
		echo "Makes it to 'else if(email_check > 0)"; // Add this line *******************
		$errorMsg = "<u>ERROR:</u><br />Your Email address is already in use inside our system. Please try another.";
	} else {
		echo "Makes it to DB insert else{} statement"; // Add this line *************************
		// Add user info into the database table, claim your fields then values
/* ***************** NOTE CHANGES TO QUERY STRUCTURE ********************* */
		$sql = "INSERT INTO members (firstname, lastname, username, password, country, state, city, accounttype, phone, mobile, business, email, website)
	VALUES ('$firstname','$lastname','$username','$password','$country','$state','$city','$accounttype','$phone','$mobile','$business','$email','$website')";
		mysql_query($sql) or die( "Query cratered with this string: " . $sql . "and produced this error: " . mysql_error() );

 

Thanks Man! I really appreciate the help, talking to machines is frigg'n hard work!

Link to comment
Share on other sites

More debugging. Check that your results are there, and in the range you'd expect. Then throw some echo statements in  the conditionals to exactly what is happening. Also, change the query string so the string is separate from the execution, This makes it possible to debug the query string and variables by echoing them, and using them in the error message.

 

$email_check = mysql_num_rows($sql_email_check); 
echo "Rows returned by \$email_check: " . $email_check . "<br />"; // Add this line *******************
echo "Rows returned by \$username_check: " . $username_check . "<br />"; // Add this line *********************
if ($username_check > 0){
                        echo "Makes it to if(username_check > 0)"; // Add this line *********************
		$errorMsg = "<u>ERROR:</u><br />Your User Name is already in use inside our system. Please try another.";
	} else if ($email_check > 0){
		echo "Makes it to 'else if(email_check > 0)"; // Add this line *******************
		$errorMsg = "<u>ERROR:</u><br />Your Email address is already in use inside our system. Please try another.";
	} else {
		echo "Makes it to DB insert else{} statement"; // Add this line *************************
		// Add user info into the database table, claim your fields then values
/* ***************** NOTE CHANGES TO QUERY STRUCTURE ********************* */
		$sql = "INSERT INTO members (firstname, lastname, username, password, country, state, city, accounttype, phone, mobile, business, email, website)
	VALUES ('$firstname','$lastname','$username','$password','$country','$state','$city','$accounttype','$phone','$mobile','$business','$email','$website')";
		mysql_query($sql) or die( "Query cratered with this string: " . $sql . "and produced this error: " . mysql_error() );

 

Thanks Man! I really appreciate the help, talking to machines is frigg'n hard work!

 

Depends on how you "talk" with them.

Link to comment
Share on other sites

Still no error messages display, and no data INSERT  :shrug:

 

<?php


// Set error message as upon arrival to page   THIS IS WORKING 
$errorMsg = "";

// Check to see if the form has previously been submitted  
if (isset($_POST['username'])){                          // THIS IS WORKING

//Connect to DB
include_once('connectDB.php');                          // THIS IS WORKING 

// Filter the posted variables                       THIS IS WORKING
$firstname = $_POST['firstname']; //mysql_real_escape_string  — 
$lastname = $_POST['lastname']; 
$username = $_POST['username']; 
$password = $_POST['password']; 
$accounttype = $_POST['accounttype'];
$country = $_POST['country']; 
$state = $_POST['state']; 
$city = $_POST['city']; 
$phone = $_POST['phone']; 
$mobile = $_POST['mobile'];
$business = $_POST['business'];
$email = $_POST['email'];
$website = $_POST['website']; 

 // Check to see if the user filled all fields with     THIS IS WORKING 
// the "Required"(*) symbol next to them in the join form
// and print out to them what they have forgotten to put in
if((!$firstname) || (!$lastname) || (!$username)  || (!$password) || (!$email) || (!$accounttype) || (!$country) || (!$state) || (!$city)){

	$errorMsg = "You did not submit the following required information!<br /><br />";
	if(!$firstname){
		$errorMsg .= "--- First Name";
	} else if(!$lastname){
		$errorMsg .= "--- Last Name";
    } else if(!$username){
		$errorMsg .= "--- UserName";
	} else if(!$password){
		$errorMsg .= "--- Password";
	} else if(!$accounttype){
		$errorMsg .= "--- Account Type";
	} else if(!$country){
		$errorMsg .= "--- Country"; 
	} else if(!$state){ 
	    $errorMsg .= "--- State"; 
    } else if(!$city){ 
        $errorMsg .= "--- City"; 
	} else if(!$email){
		$errorMsg .= "--- Email"; 
} else {
// Database duplicate Fields Check         SEEMS TO BREAK DOWN HERE BUT NO ERROR MESSAGES DISPLAY?

$sql_username_check = mysql_query("SELECT id FROM members WHERE username='$username' LIMIT 1");
         	echo "Rows returned by \$username_check: " . $username_check . "<br />";
$sql_email_check = mysql_query("SELECT id FROM members WHERE email='$email' LIMIT 1");
          $email_check = mysql_num_rows($sql_email_check);
	  	echo "Rows returned by \$email_check: " . $email_check . "<br />";
$username_check = mysql_num_rows($sql_username_check);
$email_check = mysql_num_rows($sql_email_check); 
	if ($username_check > 0){
                        echo "Makes it to if(username_check > 0)"; 
          $errorMsg = "<u>ERROR:</u><br />Your User Name is already in use inside our system. Please try another.";
           } else if ($email_check > 0){
                        echo "Makes it to 'else if(email_check > 0)"; 
          $errorMsg = "<u>ERROR:</u><br />Your Email address is already in use inside our system. Please try another.";
           } else {
                        echo "Makes it to DB insert else{} statement";

        // Add MD5 Hash to the password variable
       $hashedPass = md5($password); 

        // Add user info into the database table, claim your fields then values 
	$sql = "INSERT INTO members (firstname, lastname, username, password, country, state, city, accounttype, phone, mobile, business, email, website)
		 VALUES ('$firstname','$lastname','$username','$password','$country','$state','$city','$accounttype','$phone','$mobile','$business','$email','$website')"; 
		 	mysql_query($sql) or die( "Query cratered with this string: " . $sql . "and produced this error: " . mysql_error() );
  
  // Get the inserted ID here to use in the activation email, 
	$id = mysql_insert_id();
	// Create directory(folder) to hold each user files(pics, MP3s, etc.) 
	mkdir("memberFiles/$id", 0755); 
	// Start assembly of Email Member the activation link
	$to = "$email";
	// My site admin email
	$from = "brad@mlmnetworkingsystem.com";
        $subject = "Complete your registration";

	//Begin HTML Email Message where you need to change the activation URL inside
	$message = '<html>
	<body bgcolor="#FFFFFF">
	Hi ' . $username . ',
	<br /><br />
	Confirm your registration.
	<br /><br />
	Please click here to activate now >>
	<a href="http://www.mlmnetworkingsystem.com/activation.php?id=' . $id . '">
	ACTIVATE NOW</a>
	<br /><br />
	Your Login Data is as follows: 
	<br /><br />
	E-mail Address: ' . $email . ' <br />
	Password: ' . $password . ' 
	<br /><br /> 
	Thanks! 
	</body>
	</html>';
	// end of message
	$headers = "From: $from\r\n"; // \r opens database read only and \n creates new database truncate old versions if they exist
	$headers .= "Content-type: text/html\r\n";
	$to = "$to";
	// Finally send the activation email to the member
	mail($to, $subject, $message, $headers);
	// Then print a message to the browser for the joiner 
	print "<br /><br /><br /><h4>OK $firstname, one last step to verify your email identity:</h4><br />
	We just sent an Activation link to: $email<br /><br />
	<strong><font color=\"#990000\">Please check your email inbox in a moment</font></strong> to click on the Activation <br />
	Link inside the message. After email activation you can log in.";
	exit(); // Exit so the form and page does not display, just this success message
} // Close else after database duplicate field value checks
  } // Close else after missing vars check
} //Close if $_POST
}

?>

Link to comment
Share on other sites

Are you getting any of the echo statements in any of these?

 

$email_check = mysql_num_rows($sql_email_check); 
	if ($username_check > 0){
                        echo "Makes it to if(username_check > 0)"; 
          $errorMsg = "<u>ERROR:</u><br />Your User Name is already in use inside our system. Please try another.";
           } else if ($email_check > 0){
                        echo "Makes it to 'else if(email_check > 0)"; 
          $errorMsg = "<u>ERROR:</u><br />Your Email address is already in use inside our system. Please try another.";
           } else {
                        echo "Makes it to DB insert else{} statement";

Link to comment
Share on other sites

NUP! It doesnt echo or return any errors, weird hey?

 

I have been looking through phpMyadmin to see if it's a setting that needs changing but not sure what to look for at this point in time...

 

I had a car like this once, it would go fine then just stop, then it would start and go fine for a day or 2 then suddenly stop, the only way we could work it out was to change out computer and coil, 1 at a time, I got lucky with that one and opted for the coil first which fixed the problem.

 

This is kinda the same "for me anyway" not sure where to start the process of elimination.

 

 

Link to comment
Share on other sites

Is it telling you how many rows are returned by either of these?

 

$email_check = mysql_num_rows($sql_email_check); 
echo "Rows returned by \$email_check: " . $email_check . "<br />"; // Add this line *******************
echo "Rows returned by \$username_check: " . $username_check . "<br />"; // Add this line *********************

Link to comment
Share on other sites

Nothing, the url just reloads with the form "check it out"  http://www.mlmnetworkingsystem.com/register.php

 

Can I ask? R U OZY?

 

Sorry it's 1am here and I had a DUH moment with that link try this  http://www.mlmnetworkingsystem/jointoday.php

 

DOH!! Man I gotta get some sleep,

http://www.mlmnetworkingsystem.com/jointoday.php

don't forget the dot com

Link to comment
Share on other sites

Nothing, the url just reloads with the form "check it out"  http://www.mlmnetworkingsystem.com/register.php

 

Can I ask? R U OZY?

 

Sorry it's 1am here and I had a DUH moment with that link try this  http://www.mlmnetworkingsystem/jointoday.php

 

DOH!! Man I gotta get some sleep,

http://www.mlmnetworkingsystem.com/jointoday.php

don't forget the dot com

 

MAAAN? Your kidding I still managed to screw it up OK CONCENTRATE NOW http://www.mlmnetworkingsystem.com/jointoday.php Thats it, Im wrecked and got to get some shuteye....

Link to comment
Share on other sites

Would anyone be interested in giving me a quote to fix this failed attempt and get this form working.

 

It's pretty obvious that I don't have the necessary knowledge needed to make this work, please feel free to PM me if your interested in this small job.

 

Cheers: Brad

 

 

Link to comment
Share on other sites

Would anyone be interested in giving me a quote to fix this failed attempt and get this form working.

 

It's pretty obvious that I don't have the necessary knowledge needed to make this work, please feel free to PM me if your interested in this small job.

 

Cheers: Brad

 

Cancel that request: Someone has kindly offered to fix it for me, I cant begin to tell everyone at this forum how much I appreciate your help and especially your patience regarding this issue.

Thanks Guys:

 

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.