简体   繁体   中英

PHP FORM navigation with Hidden values

I am developing a form in PHP. There are variables which are fix which will be displayed in the link of the web page. But some variable which are passed to other page are in hidden and are not fixed.

Eg.

http://editform.php?var1=23&var2=34 will have hidden variables hidvar=23

http://editform.php?var1=23 this will not have any hidden variable and also var2 is also not there

I have checked for variable in link with isset function.
if(isset($_GET['var2']))

now how to get all the variables values in another page with all combination of hidden variables and variable in Link.

I am further adding code which let you get the Idea what I need. Below web page is saved as webform.php

<?PHP
if(isset($_GET['YID']))
{   $YRID=$_GET["YID"]; }
else
{   $YRID=0; echo "Variable Missing. Program terminated.";  }
?>

// GET THE VALUE OF $PASS;
//GET THE VALUE OF SESSIONID;
//GET THE VALUE OF YID. 


<form action="WEBFORM.php?PASS=<?PHP echo $PASS;?>" name="FORM1" METHOD="POST">
<?php
    //statement which do some operation using $YRID;
?>
<input type="hidden" name="SESSIONID" VALUE="<?PHP echo $SESID; ?>" />
</FORM>
while (list($key, $value) = each($_REQUEST)) 
{
       echo ($key.' '.$value);
}

Where $key is the variable name, $value is variable value

I have tried the below code

isset($_POST['SUBMIT'])

if form is submitted then above code will check the variable which are hidden.

for checking the hidden variables and for the variable in link i have checked using below code

if(isset($_GET['YID']))

if form is not yet submitted then above code will check the variable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM