Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Member
    Join Date
    Jan 2005
    Posts
    53
    Member #
    8598
    Hello,
    I am still very new to php and am trying to create an add information page for a client.

    PHP Code:
    <?php
    if ($_Post[op] != "add") {
     
    //bring in the form
     
    $display_block "<hr>Add Information</hr>
     <form method=\"post\" action=\"
    $_SERVER['PHP_SELF']\">
       <p><strong>Username:</strong></p>
        <input type=\"text\" name=\"username\" size=30 maxlength=75>
       <p><strong>First Name:</strong></p>
        <input type=\"text\" name=\"f_name\" size=30 maxlength=75>
       <p><strong>Last Name:</strong></p>
        <input type=\"text\" name=\"l_name\" size=30 maxlength=75>
       <p><strong>Entry date:</strong></p>
        <input type=\"text\" name=\"date\" size=10 maxlength=11>
        <select name=\"Colour Choice\" multiple>
         <option>Red</option>
         <option>Green</option>
         <option>Blue</option>
        </select>
       <p><input type=\"submt\" name=\"submit\"value=\"AddEntry\">
    </p>
    </form>"
    ;
    ?>
    When I try and run it I get this error:
    Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/sites/site61/web/addinfo.php on line 5
    I have tried adding a db quote after </hr> and removing all "\". Then I get this error:
    Parse error: parse error in /home/sites/site61/web/addstudent_course.php on line 5
    Has anyone got any ideas. I really won't look good if I pull all my hair out...wrong shaped head.
    Thanks

  2.  

  3. #2
    Senior Member
    Join Date
    Aug 2003
    Posts
    444
    Member #
    2801
    Is this the whole code? It doesn't look like it.

    Some things:

    It's $_POST, not $Post.
    Try $_POST['op'] not just $_POST[op]
    The if statement is missing the closing brace (}).

    And what is causing your error: Change the bit that says:

    <form method=\"post\" action=\"$_SERVER['PHP_SELF']\">

    to

    <form method=\"post\" action=\"" . $_SERVER['PHP_SELF'] . "\">

    That will fix it.
    eKstreme
    eKstreme.com - Free website tools!
    fontfox - free fonts Hand-picked quality fonts.

  4. #3
    Member
    Join Date
    Jan 2005
    Posts
    53
    Member #
    8598
    Thank you, eKstreme. That fixed the problem. You are right that isn't all the code but the whole script is too big and cumbersome to post. The great thing is that it now runs perfect. Again, thank you.

  5. #4
    Senior Member
    Join Date
    Aug 2003
    Posts
    444
    Member #
    2801
    You're welcome Glad to be of help.
    eKstreme
    eKstreme.com - Free website tools!
    fontfox - free fonts Hand-picked quality fonts.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:50 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com