Jump to content

ralphy45

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ralphy45's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. webmaster1, that's working like a charm, thank you to all for your help with this, very much appreciated.
  2. Hi Magnetica, In the final page, I've added it right at the start, before the <html> tag, in this form: <?php session_start(); ?> Is that right?
  3. Hey, Thank you for your help. I've just tried adding the session_start line, but still the variable value is not shown on the final page. Can you see anything else wrong?
  4. Hi, As I mentioned in my intro, I've just started learning PHP. I'm trying to write a script which will have three visible pages - one is asking for the user's name, and which page they would like to visit. The other two will be the pages which they can select from the first page, and a message saying hello. I've got this working through the session tag, but only when the form code is set to go a particular page. To allow the user to select, I've added a non-visible page, called redirect.php, which takes the value selected in the first page (the drop-down, for which page they'd like to visit), and sends them to that page. When I go through the redirect page, the session doesn't appear to 'keep' the user's name, entered on the first page. The redirect script seems to work okay, but the variable containing the username seems to be blank in the final script. Can someone advise where I'm going wrong? The three scripts are below: Starting Page: <?php session_start(); $_SESSION[‘uname’] = “testing”; ?> <html> <head> </head> <body> <?php echo "<form action='redirect.php' method='post'> <p><input type='text' name='uname'><br> <select name='gourl'> <option value=''>Choose a Destination... <option value='test2.php'>Test Page 2 <option value='test3.php'>Test Page 3 </select> <input type='submit' value='Go'> </form>"; ?> </body></html> Redirect Script: <?php $url = $_POST["gourl"]; header("Location: $url"); ?> Final Page: <html><body> <?php $testinghere = $_SESSION['uname']; echo "Hello, $testinghere \n"; ?> </body></html> I've tried loads of small edits, but like I said, I'm a beginner, so any expert advice would be very much appreciated!
  5. ralphy45

    Hey all

    Hey, I've just started learning PHP - I signed up specifically to ask for help with a particular problem, but hopefully as I learn more, I'll be able to start participating in discussions and maybe helping others too.
×
×
  • 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.