Sending variables through various PHP pages

Discussion in 'Programming' started by getseen, Jul 23, 2009.

  1. #1
    Hi there,

    I am making a website at the moment, and it has a create user account page. So, when the user creates an account, they input a name, email and password into the form. Once they have pressed submit, this is then sent to my database, along with a unique user ID. This is basically the last number entered into the database plus 1.

    However on the same php page, they are presented with a login page. If they enter their details correctly, they can go to stage 3. Now I would easily be able to take the variable via POST to stage 3 if the login varification was on the same page as stage 3, however if goes via a seperate php file. IE.

    This bit creates the client ID

     
    getseen, Jul 23, 2009 IP
  2. getseen

    getseen Greenhorn

    Messages:
    87
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #2
    This is checklogin2.php

     
    getseen, Jul 23, 2009 IP
  3. Rothbard

    Rothbard Peon

    Messages:
    19
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    pass the variables into hidden inputs in the form via php. Then it will go via post with the other stuff onto the last page.
     
    Rothbard, Jul 23, 2009 IP
  4. jamespv85

    jamespv85 Peon

    Messages:
    238
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    you're using sessions i presume? put it in a session variable and you can basically access it anywhere.
     
    jamespv85, Jul 23, 2009 IP
  5. getseen

    getseen Greenhorn

    Messages:
    87
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #5
    I was thinking of sending it via the form but as its a client ID, it should be openly accessible on each page shouldnt it, without worrying about forms.

    This $sessions sounds good, ill look it up.

    Thanks
     
    getseen, Jul 24, 2009 IP
  6. kblessinggr

    kblessinggr Peon

    Messages:
    539
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #6
    When you look it up, you'll get more info if you use the correct spelling of it as $_SESSION. For the most part session_start() and actually assigning session values will be the most you need. (you can also use session_destroy when someone clicks to log out)

    More info is here http://www.php.net/manual/en/book.session.php

    It may look like a heck of a lot there, but for what you need its quite simple.
     
    kblessinggr, Jul 24, 2009 IP
  7. getseen

    getseen Greenhorn

    Messages:
    87
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #7
    Thanks for the tip, its working perfectly.

    Right now, Im having issues with inserting extra values into mysql table when they fill in another form, i am trying


    $sql = " UPDATE sellers SET titleOfListing, propertyType, firstline, secondline, postcode, county, price, bedrooms, bathrooms, propertyStatus WHERE email ='$username1'";

    dont know why though
     
    getseen, Jul 24, 2009 IP
  8. mioot

    mioot Peon

    Messages:
    169
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Make sure that you have enabled the register_globals variable .
     
    mioot, Jul 27, 2009 IP