dear advanced php coders,
thanks for your wonderful contributions to this community.
However, I have a problem and it is summarized in the codes below… but the returned error is:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\wamp\www\dce\province\register.php on line 130
I want to fetch records from mysql and and bind them to the <SELECT><OPTION VALUE></OPTION></SELECT> controls on HTML form.
Please help me, it’s not working as the code below specifies…
Thank you!
<?php session_start();
$server="localhost";
$server_user="root";
$server_pass="";
$db_name="dce";
if (!$con=mysql_connect($server,$server_user,$server_pass)) {
die('Could not connect: ' . mysql_error()); }
elseif(!mysql_select_db($db_name, $con)) {
die("Could not connect to the database: " . mysql_error()); }
else {
}
/*
elseif (!$load_region=mysql_fetch_array(mysql_query("SELECT region_number FROM region"))) {
header("Location: ../Accounts/loginerror.php"); }
else {
//extract the column values of the database into variables.
$_regnum=$load_region['region_number']; }//region_number is the database field
mysql_close($con); //close connection*/
?>
<!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=iso-8859-1" />
<title>DCE - New Region Registration</title>
<link href="../Style/Site.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {
color: #FFFFFF;
font-weight: bold;
}
-->
</style>
</head>
<body>
<form name="form1" action="confirm_province.php" method="post" style="margin-left:15px; margin-right:20px;">
<p><b>Select Region: </b><br />
<?php echo "<Select name='reg_name' size='1' class='passwordEntry'> ";
$load_region = mysql_query("SELECT region_number FROM region ORDER BY region_number", $con);
while ($row = mysql_fetch_array($load_region)) {
echo "<option value='<?php $row['region_number']; ?>'>" . $row['region_number']."</option></select>";
}
?>
<br /><br />
<b>Location of Province:</b> <br />
<input type="text" name="pro_location" value="" class="passwordEntry" />
<br />
<br />
<b>Province Number:</b><br />
<input type="text" name="pro_num" value="" class="passwordEntry" />
<br />
<br />
<b>Username:</b> <br />
<input type="text" name="pro_uname" value="" class="passwordEntry" />
<br />
<br />
<b>Password:</b> <br />
<input type="password" name="pro_pword" value="" class="passwordEntry" />
<br />
<br />
<b>Confirm Password:</b> <br />
<input type="password" name="pro_con_pword" value="" class="passwordEntry" />
<br />
<br />
<!--<b>Email Address:</b><br />
<input type="text" name="email" value="" class="passwordEntry" /><br /><br />-->
<input type="submit" name="btnRegister" value="Register" class="submitButton" />
</p>
</form>
<p> </p>
</div>
</div>
<div class="footer">
<?php include("../footer.php");?>
</div></p>
</body>
</html>