0 Replies Latest reply on Nov 15, 2012 8:39 AM by Luko Banton

    Error:  Parse error: syntax error, unexpected ')' in C:\wamp\MemberRegistration.p

    Luko Banton

      The error I am getting is: Error: Parse error: syntax error, unexpected ')' in C:\wamp\MemberRegistration.php

      The line on the error is marked bold within the cold. That is the line giving the error. I will appreciate if you would help.

       

      CODE:

       

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

      <html xmlns="http://www.w3.org/1999/xhtml">

      <head>

      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

                <title>Registration</title>

                <link rel="stylesheet" href="style.css" type="text/css" />

                <script type="text/javascript" src="jsval.js"></script>

                <script type="text/javascript" src="Validation.js"></script>

      </head>

      <body onload="initValidation()">

      <table id="Container">

        <tr>

          <td><div id="apple.jpg"></div></td>

        </tr>

        <tr>

          <td><div id="Navigation">

                              <a href="index.php">Home</a>

                  <a style="color: #FFFF00; text-decoration:none;">Register</a>

                                    <a style="color:#FFFFFF; text-decoration:none;">Agri News</a>

                                    <a style="color:FFFFFF; text-decoration:none;">Agr Links</a>

                                    <a style="color:FFFFFF; text-decoration:none;">Agri Markets</a>

                    </div></td>

        </tr>

        <tr>

          <td>

      <?php

      /*

      This code is used to register a new member and if the the username entered  is

      in use, if it is in use it displays the username. The concept and idea was retrieved

      from http://php.about.com/od/finishedphp1/ss/php_login_code_2.htm

      */

      //Connection to the Database

      require ('DatabaseConn.inc.php');

      //This code runs if the the form has been submitted

      if(isset($_POST['submit']))

        {

          //This makes sure they did not leave any field blank

            if(!$_POST['Username']|!$_POST['Password']|!$_POST['F_Name']|

            !$_POST['L_Name']| !$_POST['Gender']|!$_POST['year']|!$_POST['month']|

            !$_POST['day']|!$_POST['Street']|!$_POST['City']|!$_POST['Code']|

            !$_POST['Country']|!$_POST['Email']|)

              {    

                die('You did not complete all of the required fields');

              } 

        }

      //Check if username is in use

      if(!get_magic_quotes_gpc())

        {

          $_POST['Username']=addslashes($_POST['Username']);

        }

        $usercheck=$_POST['Username'];

      $check=mysql_query("SELECT Username FROM Consumer WHERE Username ='$usercheck'") or

      die(mysql_error());

      $check2=mysql_num_rows($check);

       

       

      //If the name exist it displays a message and the entered details

      if($check2 != 0){

      ?>

      <div id="Middle">

                <p>Sorry, the Username <strong><?php echo $_POST['Username']; ?></strong>

                    is already in use, please choose another.

          </p>

          <form method="post" action="<?php echo $_SERVER['PHP_SElF']; ?>"

           onsubmit="return validateStandard(this,'error');" >

                     <table id="RegistrationTable">

                        <tr>

                                        <td style="width:140px;"><h4>1. Login Details</h4></td>

                                        <td colspan="2"><hr/></td>

                                       </tr>

                  <tr>

                                        <td></td>

                                              <td class="Lable">Username:</td>

                      <td style="width:430px;"><input type="text" name="username" maxlength="30" /></td>

                                      </tr>

                  <tr>

                                        <td></td>

                                        <td valign="top" class="Lable">Password:</td>

                                       <td><input type="password" name="password"  maxlength="20"

                            value="<?php echo $_POST['Password']; ?>"/>

                  <div style="color:#FF0000; font-size:14px;">

                            The Password should be 6 to 20 characters long</div>           

                  </td>

                  </tr>       

                                    <tr>

                                        <td><h4>2. About Yourself</h4></td>

                                        <td colspan="2"><hr/></td>

                                       </tr>

                  <tr>

                                        <td></td>

                                        <td class="Lable">First Name:</td>

                                        <td><input type="text" name="F_Name"  maxlength="30"

                                value="<?php echo $_POST['F_Name']; ?>" /></td>

                                      </tr>

                   <tr>

                                                 <td></td>

                                        <td class="Lable">Middle Name:</td>

                                        <td><input type="text" name="M_Name" maxlength="30" style="background-color:#FFFF66"

                                 value="<?php echo $_POST['M_Name']; ?>" /></td>

                                     </tr>

                  <tr>

                                        <td></td>

                                        <td class="Lable">Last Name:</td>

                                        <td><input type="text" name="L_Name"  maxlength="30"

                                value="<?php echo $_POST['L_Name']; ?>" /></td>

                                      </tr>

                  <tr>

                                        <td></td>

                                        <td class="Lable">Sex:</td>

                                                   <td><select name="Sex">

                                        <option value="<?php echo $_POST['Sex']; ?>"><?php echo $_POST['Sex']; ?></option>

                                        <option value="Male">Male</option>

                          <option value="Female">Female</option>

                    </select></td>

                   <tr>

                            <td></td>

                                        <td class="Lable">Birthday:</td> 

                                              <td><select name="year" style="width:75px;">

                                <option value="<?php echo $_POST['year']; ?>" selected="selected">

                                                        <?php echo $_POST['year']; ?></option>

                                                      <option value="1993">1993</option>

                                                      <option value="1992">1992</option>

                                                      <option value="1991">1991</option>

                                                                  <option value="1990">1990</option>

                              <option value="1989">1989</option>

                                                      <option value="1988">1988</option>

                                                      <option value="1987">1987</option>

                                                      <option value="1986">1986</option>

                                                      <option value="1985">1985</option>

                                                      <option value="1984">1984</option>

                                                      <option value="1983">1983</option>

                                                      <option value="1982">1982</option>

                                                      <option value="1981">1981</option>

                                                      <option value="1980">1980</option>

                                                        

                                </select>

                           <select name="month" style="width:80px;">

                                    <option value="<?php echo $_POST['month']; ?>" selected="selected">

                                                                  <?php echo $_POST['month']; ?></option>

                                                               <option value="01">01</option>

                                                      <option value="02">02</option>

                                                      <option value="03">03</option>

                                                      <option value="04">04</option>

                                                                  <option value="05">05</option>

                                                      <option value="06">06</option>

                                                      <option value="07">07</option>

                                                      <option value="08">08</option>

                                                      <option value="09">09</option>

                                                      <option value="10">10</option>

                                                      <option value="11">11</option>

                                                               <option value="12">12</option>

                          </select>

                           <select name="day" style="width:70px;">

                                    <option value="<?php echo $_POST['day']; ?>" selected="selected">

                                                                  <?php echo $_POST['day']; ?></option>

                                                      <option value="01">01</option>

                                                      <option value="02">02</option>

                                                      <option value="03">03</option>

                                                      <option value="04">04</option>

                                                      <option value="05">05</option>

                                                      <option value="06">06</option>

                                                      <option value="07">07</option>

                                                      <option value="08">08</option>

                                                      <option value="09">09</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>               

                          <div style="color:#FF0000; font-size:14px;">Date format is YYYY-MM-DD</div></td>

                  </tr>

                  <tr>

                                        <td><h4>3. Contact Details</h4></td>

                                                 <td colspan="2"><hr/></td>

                                       </tr>

                  <tr>

                                        <td></td>

                                        <td class="Lable">Street:</td>

                                        <td><input type="text" name="street" maxlength="30"

                                value="<?php echo $_POST['street']; ?>"/></td>

                                     </tr>

                  <tr>

                                        <td></td>

                                        <td class="Lable">City:</td>

                                        <td><input type="text" name="city"  maxlength="30"

                                value="<?php echo $_POST['city']; ?>"/></td>

                                      </tr>

                                    <tr>

                                        <td></td>

                                        <td class="Lable">Zip Code:</td>

                                              <td><input type="text" name="zcode"  maxlength="30"

                                 value="<?php echo $_POST['zcode']; ?>"/></td>

                                      </tr>

                            <td></td>

                                        <td class="Lable">Country:</td>

                                        <td><select name="country">

                                          <option value="<?php echo $_POST['country']; ?>" selected="selected">

                                                                  <?php echo $_POST['country']; ?></option>

                                                      <option value="Asia">Asia</option>

                                                      <option value="Australia">Australia</option>

                                                      <option value="Central America">Central America</option>

                                                      <option value="East Africa">East Africa</option>

                                                      <option value="China">China</option>

                                                      <option value="Russia">Russia</option>

                                                      <option value="Europe">Europe</option>

                                                      <option value="Japan">Japan</option>

                                                      <option value="South America">South America</option>

                              <option value="USA and Canada">USA and Canada</option>

                              <option value="Southern Africa">Southern Africa</option>

                              <option value="West Africa">West Africa</option>

                              <option value="UK">UK</option>

                              <option value="Other">Other</option>

                                      </select></td>

                  </tr>

                  <tr>

                                        <td></td>

                                              <td class="Lable">Email:</td>

                                        <td><input type="text" name="Email" maxlength="30"

                                 value="<?php echo $_POST['Email']; ?>"/></td>

                                      </tr>

                  <tr>

                                        <td></td>

                                        <td class="Lable">Tel Number:</td>

                                        <td><input type="text" name="Tele" maxlength="10"

                                value="<?php echo $_POST['Tele']; ?>"

                                          style="background-color: #FFFF66" /></td>

                                      </tr>

                  <tr>

                    <td colspan="3"><hr/></td>

                  </tr>

                  <tr>

                                        <td><input type="submit" value="Register" name="submit" class="button"/></td>

                                              <td></td>

                                              <td style="width:450px;"><input type="reset" value="Reset" class="button" /></td>

                                      </tr>

                  <tr>

                    <td colspan="3">

                              <p></p>             

                    </td>

                  </tr>

                          </table>

          </form>

      </div>

      <p>

         <a href="http://validator.w3.org/check?uri=referer">

             <img src="http://www.w3.org/Icons/valid-xhtml11"

             alt="Valid XHTML 1.1" height="31" width="88" />

         </a>

         <a href="http://jigsaw.w3.org/css-validator/check/referer">

             <img style="border:0;width:88px;height:31px"

              src="http://jigsaw.w3.org/css-validator/images/vcss"

              alt="Valid CSS!" />

         </a> 

      </p>

      <div id="Footer">© Farmer's Brokers 2012</div>

      <?php

      die();

      }

      //Registration date

      $regdate = date('Y-m-d');

       

       

      //Generating a random number

      $activationkey = mt_rand();

      //Inserting values to the database

      $insert = "INSERT INTO Consumer (Username,Password, F_Name, M_Name, L_Name, Sex, Tele,

      Birthday,Street, City, Code, Country, Email,ContactNumber,ActivationKey,Status,RegDate)

      VALUES('".$_POST['Username']."',Password('".$_POST['Password']."'),'".$_POST['F_Name']."',

      '".$_POST['M_Name']."','".$_POST['L_Name']."','".$_POST['Sex']."',

      '".$_POST['year'].".".$_POST['month'].".".$_POST['day']."','".$_POST['Street']."',

      '".$_POST['City']."','".$_POST['Code']."','".$_POST['Country']."','".$_POST['Email']."',

      '".$_POST['Tele']."','".$activationkey."','Verify','".$regdate."','")";

      $add_consumer = mysql_query($insert);

      //Sending an email with the verification code

      $to=$_POST[Email];

      //The subject of the Email

      $subject ='Farmer Broker Verification Code';

      //The message sent after Registering with the site

      $message ="Thank you for registering with us, use the code below to verify your account \r\n\n";

      $message.= "$activationkey";

      $headers = 'From: noreply@farmerbroker.org.zm' . "\r\n" .

                             'Reply-To: noreply@farmerbroker.org.zm' . "\r\n" .

                             'X-Mailer: PHP/' . phpversion();

      //Sending the message and the verification code                      

      mail($to, $subject, $message, $headers);

      ?>

                <div id="Middle" style="height:350px;">

                    <h2 style="text-align:center;">Thank you, <?php echo "$_POST[F_Name]"."

                                              "."$_POST[L_Name]"; php?>.</h2>

                  <p>

                            You have successfully registered as a member. A verification code has been sent

                      to your email box, you need to use it the first time you want to log into your

                      account. To proceed please go to the home page and log into your account.

                  </p>

                 </div>       

      <?php

      }else{

      ?>     

          <div id="Middle">

          <h3>Hi there! Ready to register with us?</h3>

            <p>We'll get you set up an account! in four easy steps! Just answer a few simple

            questions, select an username and password, and you'll be all set. The fields in

            yellow are optional.</p>

            <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"

                       onsubmit="return validateStandard(this,'error');" >

                     <table id="RegistrationTable">

                        <tr>

                                        <td style="width:140px;"><h4>1. Login Details</h4></td>

                                        <td colspan="2"><hr/></td>

                                       </tr>

                                    <tr>

                                        <td></td>

                                              <td class="Lable">Username:</td>

                      <td style="width:430px;"><input type="text" name="Username" maxlength="30" /></td>

                                      </tr>

                        <tr>

                                        <td></td>

                                        <td valign="top" class="Lable">Password:</td>

                                                 <td><input type="Password" name="Password" maxlength="20"/>

                  <div style="color:#FF0000; font-size:14px;">

                            The Password should be 6 to 20 characters long</div>           

                            </td>

                  </tr>       

                                    <tr>

                                        <td><h4>2. About Yourself</h4></td>

                                        <td colspan="2"><hr/></td>

                                       </tr>

                  <tr>

                                        <td></td>

                                        <td class="Lable">First Name:</td>

                                        <td><input type="text" name="F_Name" maxlength="30" /></td>

                                      </tr>

                  <tr>

                                                 <td></td>

                                        <td class="Lable">Middle Name:</td>

                                        <td><input type="text" name="M_Name" maxlength="30" style="background-color:#FFFF66" /></td>

                                     </tr>

                  <tr>

                                        <td></td>

                                        <td class="Lable">Last Name:</td>

                                        <td><input type="text" name="L_ame" maxlength="30" /></td>

                                      </tr>

                  <tr>

                                        <td></td>

                                        <td class="Lable">Sex:</td>

                                                   <td><select name="Sex">

                                        <option value="0">----Select----</option>

                                        <option value="Male">Male</option>

                          <option value="Female">Female</option>

                    </select></td>

                  </tr>

                                    <tr>

                            <td></td>

                                        <td class="Lable">Birthday:</td> 

                                              <td><select name="year" style="width:75px;">

                                <option value="0" selected="selected">Year:</option>

                                                      <option value="1993">1993</option>

                                                      <option value="1992">1992</option>

                                                      <option value="1991">1991</option>

                                                                  <option value="1990">1990</option>

                              <option value="1989">1989</option>

                                                      <option value="1988">1988</option>

                                                      <option value="1987">1987</option>

                                                      <option value="1986">1986</option>

                                                      <option value="1985">1985</option>

                                                      <option value="1984">1984</option>

                                                      <option value="1983">1983</option>

                                                      <option value="1982">1982</option>

                                                      <option value="1981">1981</option>

           

                          </select>

                          <select name="day" style="width:70px;">

                                    <option value="0" selected="selected">Day:</option>

                                                      <option value="01">01</option>

                                                      <option value="02">02</option>

                                                      <option value="03">03</option>

                                                      <option value="04">04</option>

                                                      <option value="05">05</option>

                                                      <option value="06">06</option>

                                                      <option value="07">07</option>

                                                      <option value="08">08</option>

                                                      <option value="09">09</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>               

                       </td>

                  </tr>

                  <tr>

                                        <td><h4>3. Contact Details</h4></td>

                                                 <td colspan="2"><hr/></td>

                                       </tr>

                  <tr>

                                        <td></td>

                                        <td class="Lable">Street:</td>

                                        <td><input type="text" name="Street" maxlength="30"/></td>

                                     </tr>

                  <tr>

                                        <td></td>

                                        <td class="Lable">City:</td>

                                        <td><input type="text" name="City" maxlength="30"/></td>

                                      </tr>

                                    <tr>

                                        <td></td>

                                        <td class="Lable">Zip Code:</td>

                                              <td><input type="text" name="Code" maxlength="30"/></td>

                                      </tr>

                  <tr>

                                        <td></td>

                                        <td class="Lable">Country:</td>

                                        <td><select name="Country">

                                          <option value="0" selected="selected">----Select----</option>

                                                      <<option value="Asia">Asia</option>

                                                      <option value="Australia">Australia</option>

                                                      <option value="Central America">Central America</option>

                                                      <option value="East Africa">East Africa</option>

                                                      <option value="China">China</option>

                                                      <option value="Russia">Russia</option>

                                                      <option value="Europe">Europe</option>

                                                      <option value="Japan">Japan</option>

                                                      <option value="South America">South America</option>

                              <option value="USA and Canada">USA and Canada</option>

                              <option value="Southern Africa">Southern Africa</option>

                              <option value="West Africa">West Africa</option>

                              <option value="UK">UK</option>

                              <option value="Other">Other</option>

                              <option value="Other">Other</option>

                                      </select></td>

                   </tr>

                   <tr>

                                        <td></td>

                                              <td class="Lable">Email:</td>

                                        <td><input type="text" name="Email" maxlength="30"/></td>

                                      </tr>

                  <tr>

                                        <td></td>

                                        <td class="Lable">Tel Number:</td>

                                        <td><input type="text" name="Tele" maxlength="30"

                                          style="background-color: #FFFF66" /></td>

                                      </tr>

              <tr>

                    <td colspan="3"><hr/></td>

                  </tr>

                  <tr>

                                        <td><input type="submit" value="Register" name="submit" class="button"/></td>

                                              <td></td>

                                              <td style="width:450px;"><input type="reset" value="Reset" class="button" /></td>

                                      </tr>

                  <tr>

                    <td colspan="3">

                              <p></p>              </td>

                  </tr>

              </table>

            </form>

            <?php

                          }

                          ?>

            </div>

              <p>

                        <a href="http://validator.w3.org/check?uri=referer">

                    <img src="http://www.w3.org/Icons/valid-xhtml11"

                     alt="Valid XHTML 1.1" height="31" width="88" />

                  </a>

                  <a href="http://jigsaw.w3.org/css-validator/check/referer">

                    <img style="border:0;width:88px;height:31px"

                    src="http://jigsaw.w3.org/css-validator/images/vcss"

                    alt="Valid CSS!" />

                  </a> 

              </p>

          <div id="Footer">© Farmer Broker 2012</div>

          </td>

        </tr>

      </table>

      </body>

      </html>