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 December 24th, 2004, 05:58 AM
Registered User
 
Join Date: Dec 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Passing Variables from PHP to PHP

I have a situation where I have a PHP page that is mixed with php and html throughout. because of this mixed format, when I try to tun my function to create thumbnails of images, the function fails to operate properly, and instead of displaying the image, it displays the ascii characters. If I put the function as it's own php page, I can set the script to a specific image and it will operate properly when the child page (b.php) is called from the parent page (a.php). This child page is supposed to be a generic process, and that is why I tried to create the function at beginning. My problem now, is passing a variable from a.php to b.php so that I can make b.php generic for all images as they arise. I have tried setting variables as global, and calling with the $GLOBALS['xxxxxxxx'], but this does not pass the variables between A.PHP and B.PHP I tried using the HTML $_POST variable call, but this seems to only work with an form input from HTML, and this is not acceptable. Is there a way to define a variable in HTML without using the <input> and having it pass to the php page?

Please help

Brian

 
Old December 28th, 2004, 10:21 AM
Authorized User
 
Join Date: Dec 2004
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to colin.horne
Default

Hi

Didn't exactly understand your description, but if you have a php script which is displaying images, normally something like this is good:

<img src="images.php?id=5">

And then in images.php, you use $_GET['id'] to find out which image you should display.

Cheers

--
Please contact me at:
Colin (dot) Horne (at) gmail (dot) com
 
Old December 28th, 2004, 05:41 PM
Registered User
 
Join Date: Dec 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you ever so much. At first, the solution you presented failed miserably, unil I found an error inmy syntax, and then viola... it worked. I am stillvery new to PHP.. thanks for the help

Brian

 
Old January 7th, 2005, 02:58 PM
Registered User
 
Join Date: Jan 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to dmblesley
Default

thanks so much for this. I have been looking for this answer for a long time.

Lesley

 
Old January 31st, 2005, 12:44 AM
Registered User
 
Join Date: Aug 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks so much for this really simple answer. i was plagued with this problem since i picked up my first book, "php, apache, mysql web development"!

However, $_GET didn't work for me, but $_REQUEST did.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing variables from HTML to php manunair PHP How-To 9 April 9th, 2006 11:27 PM
Passing PHP variables to javascript wfrisch Pro PHP 10 April 5th, 2005 05:13 AM
passing value from Php to PHP page baby PHP How-To 3 March 31st, 2005 02:13 AM
PHP passing variables to .swf file Ashleek007 Flash (all versions) 4 December 15th, 2004 09:38 PM
passing variables from PHP to Perl joconnor Beginning PHP 4 July 21st, 2004 08:13 AM





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