Hi,
I am making a form that inserts people into a database and if values is not correct it returns erros.
But I am getting this error:
Parse error: syntax error, unexpected $end in /home/lh3vs3/public_html/insert.php on line 106
But there is no line 106...
here is the code:
form
insert.phpCode:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!-- Design by Free CSS Templates http://www.freecsstemplates.org Released for free under a Creative Commons Attribution 2.5 License Name : Free Port Description: A two-column, fixed-width design for 1024x768 screen resolutions. Version : 1.0 Released : 20090122 --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Inscription</title> <meta name="keywords" content="" /> <meta name="description" content="" /> <link href="style.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body> <?php include("header.php"); ?> <div id="page"> <div id="content"> <div class="post"> <h2 class="title">Joindre le Ligue</h2> <p class="date"><?php echo date("Y.m.d"); ?></p> <div class="entry"> <form name="submit_article" method="post" action="insert.php"> <p> Nom de Famille:<br/> <input name="lname" type="text"> </p> <p> Prénom:<br/> <input name="fname" type="text"> </p> <p> E-Mail:<br/> <input name="email" type="text"> </p> <p> Âge:<br/> <select name="age"> <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> </select> </p> <p> Quartier:<br/> <select name="quartier"> <option value="Chomedy">Chomedy</option> <option value="St-Doronthe">St-Doronthe</option> <option value="Laval-Nord">Laval-Nord6</option> <option value="Laval-Des-Rapides">Laval-Des-Rapides</option> </select> </p> <p> <input type="submit" name="Submit" value="Joindre"> </p> <p class='links'> </p> </form></div> </div> </div> <!-- end #content --> <?php include("sidebar.php"); ?> <!-- end #sidebar --> <div style="clear: both;"> </div> </div> <!-- end #page --> <?php include("copyright.php"); ?> <!-- end #footer --> </div> </body> </html>
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!-- Design by Free CSS Templates http://www.freecsstemplates.org Released for free under a Creative Commons Attribution 2.5 License Name : Free Port Description: A two-column, fixed-width design for 1024x768 screen resolutions. Version : 1.0 Released : 20090122 --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Votre Inscription</title> <meta name="keywords" content="" /> <meta name="description" content="" /> <link href="style.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body> <?php include("header.php"); ?> <div id="page"> <div id="content"> <div class="post"> <h2 class="title">Votre Inscription</h2> <p class="date"><?php echo date("Y.m.d"); ?></p> <div class="entry"> <?php // first, connect to database and select table $link = mysql_connect ("localhost", "lh3vs3_ara", "1992arayugi") or die("mysql_error()"); mysql_select_db ("lh3vs3_league", $link); $lname = $_POST['lname']; $fname = $_POST['fname']; $email = $_POST['email']; $age = $_POST['age']; $quartier = $_POST['quartier']; $error = '0'; $result = mysql_query("SELECT * FROM `players` WHERE lname = '$lname'",$link); $retreive = mysql_fetch_array($result); $name = "" .$retreive['fname']. ""; /* check if lname is entered */ if(!$lname || strlen($lname = trim($lname)) == 0){ echo "Veuillez entrez votre nom de famille"; $error = '$error +1'; } /*check if fname is entered */ if(!$fname || strlen($fname = trim($fname)) == 0){ echo "Veuillez entrez votre prénom"; $error = '$error +1'; } /* check if player already entered */ elseif('$fname' == '$name'){ echo "Vous êtes déjà enregistré."; $error = '$error +1'; } /*check if email is entered */ if(!$email|| strlen($email = trim($email)) == 0){ echo "Veuillez entrez votre email"; $error = '$error +1'; } else{ /* check if email is valid */ $regex = "^[_+a-z0-9-]+(\.[_+a-z0-9-]+)*" ."@[a-z0-9-]+(\.[a-z0-9-]{1,})*" ."\.([a-z]{2,}){1}$"; if(!eregi($regex,$subemail)){ echo "Votre email n'est pas vailde."; $error = '$error +1'; } if($error>0){ echo "Veuillez retourner a la page d'inscription et réessaye"; } else{ $player = "INSERT INTO `players` (`lname`, `fname`, `email`, `age`, `quartier`, `register_time`) VALUES ('$lname', '$fname','$email','$age','$quartier', NOW())"; mysql_query($player) or die(mysql_error()); $player_stats = "INSERT INTO `player_stats` (`lname`, `fname`, `goals`, `assists`, `points`, `plus/minus`, `pim`, `ppg`, `shg`, `evg`, `shots`, `shotsp`) VALUES ('$lname', '$fname', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0')"; mysql_query($player_stats) or die(mysql_error()); echo "<br/>Votre Inscription a été enregistré<br/>"; } ?> </div> </div> </div> <!-- end #content --> <?php include("sidebar.php"); ?> <!-- end #sidebar --> <div style="clear: both;"> </div> </div> <!-- end #page --> <?php include("copyright.php"); ?> <!-- end #footer --> </div> </body> </html>
thanks for your help,
Ara


LinkBack URL
About LinkBacks
Reply With Quote

