Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 24th, 2004, 05:58 AM
Registered User
 
Join Date: Dec 2004
Location: Tumbling Shoals, Ar, USA.
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

Reply With Quote
  #2 (permalink)  
Old December 28th, 2004, 10:21 AM
Authorized User
 
Join Date: Dec 2004
Location: , , United Kingdom.
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
Reply With Quote
  #3 (permalink)  
Old December 28th, 2004, 05:41 PM
Registered User
 
Join Date: Dec 2004
Location: Tumbling Shoals, Ar, USA.
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

Reply With Quote
  #4 (permalink)  
Old January 7th, 2005, 02:58 PM
Registered User
 
Join Date: Jan 2005
Location: , , .
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

Reply With Quote
  #5 (permalink)  
Old January 31st, 2005, 12:44 AM
Registered User
 
Join Date: Aug 2004
Location: cambridge, ma, USA.
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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 12:35 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.