Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 21st, 2005, 11:32 AM
Registered User
 
Join Date: Feb 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default passing value from Php to PHP page

Hi
  I am new to this forum , and new to Php,i have one doubt.


First there is one page called Index.php, that page contains menus in javascript ,While clicking a menu item in a page, corresponding value is to be passed to the next page (php page), and that page should be opened.




help me .........:)

 
Old February 23rd, 2005, 05:56 AM
Authorized User
 
Join Date: Feb 2004
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to knight
Default

hi

can u post ur code infact it will too helpful to understand
ur problem


 
Old March 27th, 2005, 02:32 AM
Authorized User
 
Join Date: May 2004
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to ruhin Send a message via AIM to ruhin Send a message via MSN to ruhin Send a message via Yahoo to ruhin
Default

You can use hidden fileds to pass informations throughout the pages.
Also getting data from forms are quite easy.
<code>
<form action=\"thenextpage.php\" method=\"POST\">
 Input Data :<input type=\"text\" name=\"somename\">
 <input type=\"SUBMIT\" value=\"GO\">
</form>
</code>

       Now if you write $datafetched = $_POST['somename']; at the beginning of the page the variable would contain the information from the previous page to the next page in the variable $datafetched.

       SESSION is the smartest and convenient way to pass data throught pages. Once session variable is set, it is served throghout the visit of the site till the page is closed. Read other threads on using sessions or let us know if you need further info on session.
 
Old March 31st, 2005, 02:13 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 357
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anshul
Default

Perhaps u r talking of querystrings: index.php?rqstr=aha
U can retrieve such variable on a target page ( here, index.php ) using $_GET['rqstr'] or $HTTP_GET_VARS['rqstr'] or $_REQUEST['rqstr']Now u may write a switch/case PHP statement -n- do what u want :)






Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing data from PHP to Javascript oldBroh Javascript How-To 12 June 12th, 2008 11:12 PM
Passing variables from HTML to php manunair PHP How-To 9 April 9th, 2006 11:27 PM
passing javascript to php by Snib ismnanie Pro PHP 5 February 4th, 2005 07:07 AM
Passing Variables from PHP to PHP brian3166 PHP How-To 4 January 31st, 2005 12:44 AM
passing data to php pgm Maureen Beginning PHP 8 October 17th, 2003 03:40 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.