Re: passing parameter to function
| From: | Robbie Staufer | Date: | Thu, 26 Feb 2004 20:44:42 +0000 |
| Subject: | Re: passing parameter to function | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-33164@lists.php.net to get a copy of this message | ||
Thanks for responding.
script 1 receives the value of $codename from previous scripts - ultimately from user input. So in script 1, I can't hard-code the value as "blah". Should have mentioned that before.
Up to now, I've been using
<input type = 'hidden' name = 'codename' value='$codename'>
This works fine for passing the value of $codename from script to script. But the script in question - script 1 - has to pass the value of $codename into a function, which in turn passes the value to script 2. Script 2 accesses a db and prints out records containing codename = 'blah'.
Thanks,
Robbie
Hutchins, Richard wrote:
Script 1: <form name="myform" method="post" action="script2.php"> <input type="hidden" name="codename" value="blah"> ...other form stuff as necessary... </form> Submit the form. Script 2: Access the data passed in the hidden field as $_POST["codename"]. For example, echo $_POST["codename"]; Rich-- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* Robbie Staufer NCAR/SCD 1850 Table Mesa Dr. Rm. 42 Boulder, CO. 80305 (303) 497-1836-----Original Message----- From: Robbie Staufer [mailto:rstaufer@scd.ucar.edu] Sent: Thursday, February 26, 2004 3:21 PM To: php-db@lists.php.net Subject: [PHP-DB] passing parameter to function Hi, Say I have a script that knows the value of a variable $codename. The script contains a function that needs to know the value of $codename. What is the syntax for passing the parameter to the function? Example: the script knows that $codename = blah. The function has to pass 'blah' on to another script as a hidden value in a form using the POST method. The other script is not receiving the value of $codename. Thanks for any help. Robbie -- -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* Robbie Staufer NCAR/SCD 1850 Table Mesa Dr. Rm. 42 Boulder, CO. 80305 (303) 497-1836 -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php