Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Passing params to html with PHP

Passing params to html with PHP
Thread Tools
Zimwy
Dedicated MacNNer
Join Date: May 2002
Location: Brooklyn, NY
Status: Offline
Reply With Quote
May 26, 2003, 02:37 AM
 
Hi,
I've hunted around online, and apparently this should work:

Code:
a href = "page.php?param=5"
and then having a page called page.php which has:
[PHP]
<?php
echo("They passed me $param");
?>
[/PHP]
But that simply does not work for me. I get "The passed me" and that's it. One post said that this would work only "if php was set up to do so." Do I need to turn this option on somewhere? Any ideas? Thanks!

gabe
     
Colonel_Panic
Junior Member
Join Date: Aug 2002
Location: 127.0.0.1
Status: Offline
Reply With Quote
May 26, 2003, 03:04 PM
 
That would be

<?
echo("They passed me ".$_REQUEST['param']);
?>
     
Synotic
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
May 26, 2003, 03:31 PM
 
Also a quick search on php.net pulled this up, for further reference.
     
Colonel_Panic
Junior Member
Join Date: Aug 2002
Location: 127.0.0.1
Status: Offline
Reply With Quote
May 26, 2003, 10:03 PM
 
Thats from a form though in a form you use $_POST or $_GET depending on what you defined in the form tag.. In this case he is using an A HREF so he would use the $_REQUEST variable/array.
     
Colonel_Panic
Junior Member
Join Date: Aug 2002
Location: 127.0.0.1
Status: Offline
Reply With Quote
May 26, 2003, 10:05 PM
 
One post said that this would work only "if php was set up to do so."
Forgot to add, This is as security issue. Its called Global Variables. In older versions of PHP your way would work ( or a version will global variables off..) but its better if you learn to code using $_SERVER $_GET $_POST $_COOKIE and so on.
     
darcybaston
Grizzled Veteran
Join Date: May 2000
Location: ON, Canada
Status: Offline
Reply With Quote
Dec 21, 2003, 01:50 PM
 
$_REQUEST!!!! You guys are gods, I've been looking for that answer all day. Thanks! I kept trying to use $_POST for manual url/data addresses.
Macbook (white glossy) 2.16GHz | 4GB RAM | 7200RPM HD | 10.5.x
     
   
 
Forum Links
Forum 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 On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 12:01 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,