Re: PHP passing variable (help)
From: Mark Kuiphuis (maluka_at_remove_this.koekeloekoe.nl)
Date: 04/08/04
- Next message: nirvanasource: "Re: PHP Includes - Folder depth"
- Previous message: hoganh: "PhP calendar"
- In reply to: Jason: "PHP passing variable (help)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 08 Apr 2004 16:31:30 +0200
Basically passing parameters is very very simple from one page to the
other page!!
First the POST (where you need a <FORM>)
page1.php
--- <form method="post" action="page2.php"> <input type="hidden" name="parameter1" value="value1"> <input type="submit" name="submit" value="Submit"> </form> --- page2.php --- <?php $parameter1 = $_POST["parameter1"]; echo "Parameter1 = $parameter1"; ?> Parameter 1 = value1 will be shown in the browser! -- GET is also possible, but I never use that in a form because then I will see a list with parameters in the Address bar and you are limited to a certain length of the parameterstring Passing parameters by url. Page1.php --- <html> <head></head> <body> Link </body> </html> -- page2.php -- <?php $parameter1 = $_REQUEST["p1"]; $parameter2 = $_REQUEST["p2"]; echo "First parameter = $parameter1<br>"; echo "Second parameter = $parameter2<br>"; ?> --- Have fun :) Mark Jason wrote: > I think I have no clue of what I am doing. Well I know that is the case, > but here is what I am attempting to do. Pass one variable to another page. > > Running under RH 9, php version 4.2.2 > In this snip of code I pull information out from a mysql db and create a > variable of NOp_tckid from ($row['tckid']). > > <? > echo '<p><strong>'.($i+1).'. Ticket #'; > echo stripslashes($row['tckid']); > $NOp_tckid = ($row['tckid']); > echo '<br /> Test to see if $NOP_tckid works '; > echo "$NOp_tckid"; > ?> > The above part works fine. > > > I then am trying to push that variable to another page. by using: > <form method="post" action="net_ops_approve.php"> > > <input type="submit" name="submit"> > > I don't know of any other way to do it. > > On the net_ops_approve.php page the variable $NOp_tckid does not make it. I > use the below code to verify it. > > <? > echo '<p><strong>'.($i+1).'. Ticket #'; > echo "$NOp_tckid"; > print "$NOp_tckid"; > echo '<br />'; > ?> > > Does anyone know how to correct this. > > Thank you in advance for any assistance you are willing to proved.
- Next message: nirvanasource: "Re: PHP Includes - Folder depth"
- Previous message: hoganh: "PhP calendar"
- In reply to: Jason: "PHP passing variable (help)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|