Results 1 to 2 of 2

Thread: PHP index help

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2007
    Posts
    183

    PHP index help

    Hello,

    I really need help with the index page. The following instructions that I want to give PHP will explain what I want it to do:

    1. Start a Session.
    2. Write HTML code to display the contents of this page. (don't use the echo("") command)
    3. Login to the MySQL server.
    4. Select the database database1
    5. Check the table usernames for the username registered/entered.
    6. If (s)he wants to register it, and the username doesn't exist, insert it into the table along with his/her name and write, "You are now registered." If it does, write, "That username has already been registered."
    7. But, if (s)he is trying to log in, and the username exists, write a link to page2.html with the title "Continue" and set the value of the session variable, "username." If it doesn't, write "Username doesn't exist."

    I tried telling PHP to create the "username" session variable in the HEAD of the document and make it a blank variable, but I got the following error message:

    Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting T_VARIABLE or '$' in /home/content/r/a/n/ranazburr/html/index.php on line 26

    Should I write the code in the HEAD and redirect the browser to certain pages?

    Help would be appreciated

    moonman239

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: PHP index help

    You should do all processing before sending any headers or HTML. That gives you complete control over the response.

    As for the parse error, we'll have to see the code on that line to help.

Posting Permissions

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



Click Here to Expand Forum to Full Width