Hello,

Q.

With php I know we can Create a Form and have it POST to read on the next page. Great! NOW can it post to a third page, without using a form again. I just want to carry the users name around, so to say.

Design so my pages are personalized showing the users name whatever page they go to.

You see the username is Posting on page 2 this is what i want...
But! When the user clicks a next 3rd page I cannot get their name to show automatically - I want it to show like it did on page 2, It can't be the user has to enter their username on a form again and again.

P.S - My register_global are off and I have no access to my php.ini file
none of these can be configured, So I need to know how to do it without what register_globals OFF and the php.ini file default at 0 ....


The answer will be much appreciated! A big Thank-you

Recommended Answers

All 5 Replies

How to use sessions is what I am trying to understand!

I have the username on the 2nd page all is good, I have the username attached to the address
on the 3rd page,Like so,
http://www.puddinpatchdatematch.com/welcomed.php?$username=puddin
But I cannot get it to post on the darn page!

HOW DO I GET IT TO POST ON THE PAGE!!!

I just got it!

echo $_REQUEST;


I hope this helps someone.

Sorry here is the complete way to do it!

PART ONE:

On your FORM page add this part to the address:

?$username=<?echo $_POST["username"]?>"> After the .php address

I wanted the username to show up on my next page - $username is my variable

The link has to look like below with the above part added to the FORM address and any other links you want it to work with:

You start by adding it to your FORM address it looks like this:

<form action="welcome.php?$username=<?echo $_POST["username"]?>" method="post">
Username:<input type="text" name="username" value="" size="10">
&nbsp;&nbsp;Email Address:<INPUT TYPE="password" size=10 name="email_address">
&nbsp;<input type="submit" value= "Submit">
&nbsp;<input type="reset" value="Reset">
</form>


Than any other links you add to look like this:
<a href="http://www.your_link_page.php?$username=<?echo $_POST["username"]?>">


PART TWO:

On the page you want it to show up on at the very top of the page have :
<?
session_start();
?>
Check this session_start(); may need t be on both pages.

And last place this on the page you want to display your variable:
<?
echo $_REQUEST;
?>

It looks really nice and works Great!

ABOUT PART TWO...

The PART TWO ABOVE goes on the same page ...


<?
session_start();
?>

Goes at the very top of the page and the other part goes on the same page. Place it where you want it to show on your webpage

<?
echo $_REQUEST;
?>


It looks very nice but after viewing going to a next page and click try to go back you get an error message ... It won't go back. If you know how to correct this please let me know, Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.