Jump to content

Recommended Posts

Hi Freaks

 

I am a newbie, and have a simple problem.

 

I just made a form and an action wich calls a new page "site.php". On this new page I call the value in the form by get:

 

<?

$websted=$_GET['websted'];

echo "<p><b>$websted</b></p>";?>

 

Everything is ok, but now I like the user to fill out another form wich call a new page "site1.php"

 

On this new page I like to call both the formvalue from the first page and the formvalue from the second page.

 

<?

$websted=$_GET['websted'];

                          $hi=$_GET['hi'];

echo "<p><b>$websted</b></p>";

echo "<p><b>$hi</b></p>";?>

 

BUT it seems impossible since the first value seems to be forgotten!

 

How can I call both the first and the second formvalue? How can I transfer the first value to the last page?

 

Thanks!

 

Cromagnon

 

 

Link to comment
https://forums.phpfreaks.com/topic/83465-how-to-call-an-old-value/
Share on other sites

The easiest way to transfer over is take your

 

<?
      $websted=$_GET['websted'];
echo "<p>$websted</p>";?>

 

and make a hidden form value to submit with the form on site.php into site1.php in other words in your case..

 

<input type="hidden" name="websted" value="<?php echo $websted; ?>">

 

make sure its in between your

<form></form>

 

and should transfer onto site1.php no problem.. just call it the same way you did with site.php and make sure its a form field on site.php is a diffrent name from your hidden value

Just noticed you use a GET value and a variable in Danish, so here is a word of advice: It's better to have your variable and function names in English. They must be named like this (regex): ^[_a-zA-Z][_a-zA-Z0-9]*$ (i.e. it must only contain the letters a through z (upper case and lower case), an underscore and digits and it must start with an underscore or one of the before mentioned letters) and at some point you might need to use a name where the allowed characters are not sufficient.

Session would be better deffinately agree'd but only reason I mentioned it the way is some service providers either block sessions, or make them a pain in the arse to do.. or atleast with experiances I have had in the past, my way is a work around but not nessisarily the best in this senerio, if you have session ability

I haven't seen any of them block them, but I have seen the PHP.INI setup incorrectly by them.

 

Session would be better deffinately agree'd but only reason I mentioned it the way is some service providers either block sessions, or make them a pain in the arse to do.. or atleast with experiances I have had in the past, my way is a work around but not nessisarily the best in this senerio, if you have session ability

Session would be better deffinately agree'd but only reason I mentioned it the way is some service providers either block sessions, or make them a pain in the arse to do.. or atleast with experiances I have had in the past, my way is a work around but not nessisarily the best in this senerio, if you have session ability

Then people hosted by companies like that should switch because using hidden form fields is a potential security risk.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.