I corrected those things
now my register.php like this
<?php
// Require the configuration before any PHP code as the configuration controls error reporting:
require ('../includes/config.inc.php');
$page_title = "Institute | Registration - Step 1";
include ('includes/header.html');
// Require the database connection:
require (MYSQL2);
// For storing registration errors:
$reg_errors = array();
// Check for a form submission:
//if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ( isset( $_POST['submitted'])) {
// Check for a institute name:
if (preg_match ('/^[A-Z \'.-]{2,80}$/i', $_POST['ins_name'])) {
$insName = mysqli_real_escape_string ($dbc, $_POST['ins_name']);
} else {
$reg_errors['ins_name'] = 'Please enter your Institute name correctly!';
}
// Check for a institute slogan:
$Slogan = (!empty( $_POST['ins_slogan'])) ? mysqli_real_escape_string ( $dbc, $_POST['ins_slogan']) : NULL;
// Check for the address one:
if (!empty($_POST['address1'])) {
$address1 = mysqli_real_escape_string($dbc, $_POST['address1']);
} else {
$reg_errors['address1'] = 'Please enter a Address One correctly!';
}
// Check for a institute slogan:
$address2 = (!empty( $_POST['address2'])) ? mysqli_real_escape_string ( $dbc, $_POST['address2']) : NULL;
// Check for a telephone number:
$tel = ( !empty( $_POST['tel'])) ? mysqli_real_escape_string ( $_POST['tel']) : NULL;
// Check for a mobile number:
if ( is_numeric( $_POST['mobile'])) {
$mobile = mysqli_real_escape_string ( $dbc, $_POST['mobile']);
} else {
$reg_errors['mobile'] = 'Please enter a Mobile number correctly!';
}
// Check for an email address:
if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
$email = mysqli_real_escape_string ($dbc, $_POST['email']);
} else {
$reg_errors['email'] = 'Please enter a valid email address!';
}
// Check for a password and match against the confirmed password:
if (!empty($_POST['pass1'])) {
if ($_POST['pass1'] == $_POST['pass2']) {
$pass = mysqli_real_escape_string ($dbc, $_POST['pass1']);
} else {
$reg_errors['pass2'] = 'Your password did not match the confirmed password!';
}
} else {
$reg_errors['pass1'] = 'Please enter a valid password!';
}
// Check for a web address:
$web = ( !empty( $_POST['web'])) ? mysqli_real_escape_string ( $dbc, $_POST['web']) : NULL;
// Check for a facebook address:
$tel = ( !empty( $_POST['fbName'])) ? mysqli_real_escape_string ( $dbc, $_POST['fbName']) : NULL;
// Check for a best time to call:
if (!empty($_POST['timetocall'])) {
$bestTime = mysqli_real_escape_string ($dbc, $_POST['timetocall']);
} else {
$reg_errors['timetocall'] = 'Please enter a convenient time to contact you!';
}
// Check for Institute Options:
if(empty( $_POST['option'])) {
$reg_errors['option'] = 'Please select at least one tuition option';
} else {
$option = $_POST['option'];
print_r ( $option );
}
// Check for Institute medium:
if(empty( $_POST['medium'])) {
$reg_errors['medium'] = 'Please select at least one tuition medium';
} else {
$option = $_POST['medium'];
print_r ( $option );
}
if( isset( $_POST['district'])) {
$district = $_POST['district'];
}
if (isset( $_POST['submit'])) {
$city_id = $_POST['city_id'];
}
if (empty($reg_errors)) { // If everything's OK...
// Make sure the email address and username are available:
$q = "SELECT email FROM login WHERE email='$email'";
$r = mysqli_query ($dbc, $q);
// Get the number of rows returned:
$rows = mysqli_num_rows($r);
if ($rows == 0) { // No problems!
echo 'there is no such a email';
// Add the login details to the database...
$q = "INSERT INTO login (email, password, login_level, last_login)
VALUES ('$email', '" . get_password_hash($pass) . "', 2, now() )";
$r = mysqli_query ($dbc, $q);
$loginId = mysqli_insert_id($dbc);
if ( $r ) {
echo 'good';
} else { echo 'bad';
echo '<p>' . mysqli_error($dbc) . '<br />Query: ' . $q . '</p>'; // Debugging message.
}
echo $district;
echo $city;
echo '<br /><br /><br />';
echo $loginId;
//if (mysqli_affected_rows($dbc) == 1) { // If it ran OK.
} else { // The email address or username is not available.
$reg_errors['email'] = 'This email address has already been registered. Try again with a different email';
} // End of $rows == 0 IF.
} // End of empty($reg_errors) IF.
} // End of the main form submission conditional.
?>
<div id="inner_wrapper">
<div id="contents">
<div id="content2">
<h1>Registration</h1>
<div style="height: 15px; background: #fff;" class="extra_top"></div>
<div id="content_body">
<?php
require ('/includes/form_functions.inc.php');
?>
<h2>Basic Infomation</h2>
<form name="centerRegister" action="register.php" method="post" accept-charset="utf-8" >
<p style="margin: -15px 0 10px 0; font-weight: normal;">Required fields are marked with <img src="../images/required_star.png" alt="required" /></p>
<div class="group">
<div>
<label for="ins_name">Institute Name <img src="../images/required_star.png" alt="required" /> : </label>
<?php create_form_input('ins_name', 'text', $reg_errors); ?>
</div>
<div>
<label for="ins_slogan">Institute Slogan : </label>
<?php create_form_input('ins_slogan', 'text', $reg_errors); ?>
</div>
</div>
</div>
<div style="height: 15px; background: #fff;" class="extra_bottom"></div>
<br /><div style="margin-bottom: 4px;"></div>
<div style="height: 15px; background: #fff;" class="extra_top"></div>
<div id="content_body">
<h2>Contact Information</h2>
<div class="group">
<div>
<label for="address1">Address 1 <img src="../images/required_star.png" alt="required" /> : </label>
<?php create_form_input('address1', 'text', $reg_errors); ?>
</div>
<div>
<label for="address2">Address 2 : </label>
<?php create_form_input('address2', 'text', $reg_errors); ?>
</div>
<div>
<label for="district">District <img src="../images/required_star.png" alt="required" /> : </label>
<?php
require_once ('../includes/config.inc.php');
require_once( MYSQL2 );
$query="select * from district order by district_id";
$result = mysqli_query( $dbc, $query);
//echo '<select name="district" class="text" onChange="getCity(' . "'" . 'findcity.php?district=' . "'" . '+this.value)">';
//echo '<select name="district" class="text" onChange="getCity(' . '\'findcity.php?district=\'+this.value+\'&city=\'' . '+document.getElementsByName(\'city\')[0].value)">';
echo '<select name="district" class="text" id="district" onChange="getCity(' . "'" . 'findcity.php?district=' . "'" . '+this.value)">> ';
echo '<option value="">-- Select District --</option>';
while( $row = mysqli_fetch_array($result, MYSQLI_NUM)) {
echo '<option value="' . $row[0] . '"';
// Check for stickyness:
if ( isset( $_POST['district']) && ( $_POST['district'] == $row[0] ))
echo ' selected="selected"';
echo " >$row[1]</option>";
}
echo '</select>';
?>
</div>
<div>
<label for="city">City <img src="../images/required_star.png" alt="required" /> : </label>
<div id="citydiv" style="position: relative; top: -14px; left: 130px; margin-bottom: -26px;">
<select name="city" class="text">
<option>-- Select City --</option>
</select>
</div>
</div>
<div>
<label for="tel">Telephone No : </label>
<?php create_form_input('tel', 'text', $reg_errors); ?>
</div>
<div>
<label for="mobile">Mobile <img src="../images/required_star.png" alt="required" /> : </label>
<?php create_form_input('mobile', 'text', $reg_errors); ?>
</div>
<div>
<label for="email">Email Address<img src="../images/required_star.png" alt="required" /> : </label>
<?php create_form_input('email', 'text', $reg_errors); ?>
</div>
<div>
<label for="pass1">Password <img src="../images/required_star.png" alt="required" /> : </label>
<?php create_form_input('pass1', 'password', $reg_errors); ?>
</div>
<div>
<label for="pass2">Conform Password <img src="../images/required_star.png" alt="required" /> : </label>
<?php create_form_input('pass2', 'password', $reg_errors); ?>
</div>
<input type="submit" name="submitted" value="Register" class="formSubmit" />
<!-- <input type="hidden" name="submitted" value="TRUE" /> -->
</div>
</form>
</div>
</div> <!-- end contents div -->
</div> <!-- end inner_wrapper div -->
</div> <!-- end wrapper1 div -->
<?php
include ('includes/footer.html');
?>
now I can get this error message....
An error occurred in script 'C:\wamp\www\lanka_institute\centersignup\institute_registration_form.php' on line 164: Undefined variable: city_id
Date/Time: 5-15-2012 06:59:40
Array
( .......... and so on