Jump to content

wots wrong in this script?


zals07

Recommended Posts

"i was writing a script for registery form ,but, i am stuck in half of ma coding ..i am using apache as ma local web server. the problem is i am getting an error while checking it ,note:second half of ma coding i left empty bcoz i couldnt get it working ".

the code is below :

this is the error :" Parse error: syntax error, unexpected $end in /opt/lampp/htdocs/index.php on line 83"

 

<? php

  include <zals.php>

?>

   

<html>

<head>

  <title>

    Register Form

  </title>

</head>

        <body>

        <center>

        <form method ="POST" action="index.php"

        <table border="0" style="text-align: left; border: 1 px solid black; cell padding: 2px; font-family: Tahoma; font-size: 12px;">

        <tr>

          <td>

          Username:

          </td>

          <td>

          <input type="text" name="username">

          </td>

        </tr>

        <tr>

          <td>

          Password:

          </td>

          <td>

          <input type="password" name="password">

          </td>

        </tr>

        <tr>

          <td>

          Gender:

          </td>

          <td>

          <select name="gender">

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

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

          </select>

          </td>

        </tr>

        <tr>

          <td>

          Birth year:

          </td>

          <td>

          <select name="birth_year">

<?php

  $num = 1901;

  while($num <= 2008) {                             

  $num ++;

  echo "<option value=".$num.">".$num."</option>";

  }                           

?>

          </select>

          </td>

        </tr>

        <tr>

          <td colspan="2" align="center">

          <input type="submit" name="submit" value="Submit">

          </td>

        </tr>

          </table>

          </form>

<?php  if($_POST ['submit']) { ?>

            <table border="0" style="color: red; width:150; margin-top: 5px; border: 1px solid black; padding: 2px;font=family: Tahoma; font-size: 12px;">

   

            <?php

              $curnum = 0;

              $username = $_POST['username'];               

              $password = $_POST['password'];

              $gender = $_POST['gender'];

              $byear = $_POST['birth_year'];

       

              if(!$username) {

                $curnum ++;

                echo "<tr><td>".$curnum.". Please enter a username.</td></tr>

                            }

            ?> 

          </table><?php } ?>

          </center>

          </body>

          </hmtl>

 

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/163020-wots-wrong-in-this-script/
Share on other sites

Can you see your error once you put it inside code tags w/highlighting?

 

<?php
              $curnum = 0;
              $username = $_POST['username'];                
              $password = $_POST['password'];
              $gender = $_POST['gender'];
              $byear = $_POST['birth_year'];
         
              if(!$username) {
                 $curnum ++;
                 echo "<tr><td>".$curnum.". Please enter a username.</td></tr> 
                             }
             ?> 

 

(the missing "; at the end of the echo statement)

 

PS - next time use code tags please :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.