SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: syntax error

  1. #1
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    292
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    syntax error

    pleae i am a syntax error, can u figure it please

    PHP Code:
    <?php

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <
    html xmlns="http://www.w3.org/1999/xhtml">
      <
    head>
        <
    title>Reacheasy Foremost website for easy reach of things globally</title>
        <
    meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
    <
    link href="easy.css" rel="stylesheet" type="text/css"/>  
    </
    head>
      <
    body>
    <
    div id="outer">
    <
    div id="page">
    <
    div id="header">
    <
    h1>Reacheasy</h1>
      <
    ul id="nav">
        <
    li class="current"><a href="index.html">Home</a></li>
         <
    li><a href="women.html">Women</a></li>
         <
    li><a href="men.html">Men</a></li>
         <
    li><a href="children.html">Children</a></li>
         <
    li><a href="homeandappliances.html">Home&amp;Appliances</a></li>
         <
    li><a href="visionandsound.html">Vision&amp;Sounds</a></li>
          <
    li><a href="motoring.html">Motoring</a></li>
          <
    li><a href="homemore.html">More</a></li>
          <
    li><a href="homecontact.html">Contact us</a></li>
          <
    li><a href=" rl.html">Register/Log in</a></li>
      </
    ul>
    </
    div> <!--end of navigation div -->
    </
    div>

    <
    div id="bodycontent">
    <
    div>
    <?
    php
    echo "<h1>Register</h1>";

    $submit $_POST['submit'];
    //form data
    $fullname strip_tags($_POST['fullname']);
    $username strtolower(strip_tags($_POST['username']));
    $password strip_tags($_POST['password']);
    $repeatpassword strip_tags($_POST['repeatpassword']);
    $date date("Y-m-d");

    if (
    $submit)
    {
    //open database
    $connect mysql_connect("localhost","reachea2","HYW6QwoV");
    mysql_select_db("reachea2_registeringmembers");//select database

    $namecheck mysql_query("SELECT username FROM reusers WHERE username='$username'");
    $count mysql_num_rows($namecheck);

    if(
    $count!=0)
    {
    die(
    "Username already taken!");

    }


    //check for registration form details
        
    if ($fullname&&$username&&$password&&$repeatpassword)
    {

    if (
    $password==$repeatpassword)
    {
    //check char lenght of username and fullname
    if (strlen($username)>25||strlen($fullname)>25)
    {
    echo 
    "Lenght of username or fullname is too long";
    }
    else
    {
    //check password length
    if(strlen($password)>25||strlen($password)<6)
    {
    echo
    "Password must be between 6 and 25 characters";
    }else

    {
    //register the user!
    //encript password
    $password md5($password);
    $repeatpassword md5($repeatpassword);


    $queryreg mysql_query("

    INSERT INTO reusers VALUES ('','
    $fullname','$username','$password','$date')

    "
    );

    die(
    "You have been registered!<a href='rl.php'>Return to login page</a>");
    }
    }
    }
    else
        echo
    "Your passwords do not match!";

    }
    else
            echo 
    "Please fill in <b>all</> fields!";

    }
    ?>
    </div>
    <p>
    <form action='reregister.php' method='Post' class='rl'>
        <div>
        <label for='fullname' class='fixedwidth'>Your full name</label>
        <input type='text' name='fullname' id='username' value='<?php echo $fullname?>'/>
        </div>
        
        <div>
        <label for='username' class='fixedwidth'>Choose a user name</label>
        <input type='text' name='username' id='username' value='<?php echo $username?>'/>
        </div>
        
        <div>
        <label for='password' class='fixedwidth'>Choose a password</label>
        <input type='password' name='password' id='password'/>
        </div>
        
        <div>
        <label for='repeatpassword' class='fixedwidth'>Repeat your password</label>
        <input type='password' name='repeatpassword' id='repeatpassword'/>
        </div>
        
        <div class='buttonarea'>
                <p>
                <input type='submit' name='submit' value='Register'>
                </p>
                </div>
                </p>

    </form>
    </div>

    <div id="footer">
    <ul id="footlink">
         <li><a href="contact.html">Contact us</a></li>
         <li><a href="termsandcondition.html">Terms&amp;Condition</a></li>
         <li><a href="right.html">Copyright</a></li>
         <li><a href="faq.html">Faq</a>
    </li>
    </ul>
    </div>
    </div>
    </body>
    </html>

    ?>

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,604
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    HTML is not PHP so you shouldn't have the <?php tag at the top claiming that what follows is PHP when the code at the start is actually HTML.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    292
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    thanks fegal, i removed the php tag, and it was aii, i was of the impression that since i could put html in php, and vice versa, that the php tag wouldnt matter

  4. #4
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,604
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    Yes you can put PHP and HTML in the same file but all the PHP must be wrapped in <?php ?> and the HTML must either be outside of the PHP wrapper or enclosed in echo or print statements.

    The only ?> you can leave off is where you have PHP right at the end of the page with no HTML after it.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  5. #5
    SitePoint Addict
    Join Date
    Oct 2010
    Posts
    292
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    thanks fegal


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •