Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,194,304 members, 7,954,223 topics. Date: Friday, 20 September 2024 at 02:42 PM |
Nairaland Forum / Science/Technology / Webmasters / Linking Using Php (682 Views)
Problem: Centering Text Using Php's Imagettftext / Does Anyone Know How To Send Emails As Sms To Mobile Phones Using PHP / Writing A Time Based Expiration Script Or Function Using Php And Mysql (2) (3) (4)
Linking Using Php by mikkytrio(m): 12:54am On Nov 01, 2009 |
please can php variables be transfered from one page to another not in forms? eg index.php <?php $name = "yaro dan baba"; $surname = "dan yaro"; <html> <body> <a href="friends.php"><?php echo "$name";?></a> </body> </head> ?> when the $name is clicked it leads to friends.php and on the friends.php page a new variable is declared but with same value as $surname friends.php <?php $re = $surname; //or so am not so sure how this is done please this is where i am stuck just like the $_POST or $_GET for forms i want to try the one for hyperlinks please |
Re: Linking Using Php by yawatide(f): 2:26am On Nov 01, 2009 |
<a href="friends.php?surname=<?php echo $surname;?>"><?php echo $name;?></a> Also, u might wanna get rid of the spaces between the words in those variables. You could either replace the spaces with hyphens or underscores or assign each word to a separate variable, attach them to the hyperlink like so: <a href="friends.php?surname1=<?php echo $surname1;?>&surname2=<?php echo $surname2;?>"> <?php echo $name;?> </a> then on the friends.php page, you concatenate the variables. Good luck! |
Re: Linking Using Php by mikkytrio(m): 2:33am On Nov 01, 2009 |
thanks blood. let me try it out |
Re: Linking Using Php by yawatide(f): 9:11am On Nov 01, 2009 |
no yawa. By the way, You will have to use $_GET on the friends.php page, since you are getting the values passed via url. There's no escaping that. It doesn't apply to only forms. Also, personally, I prefer $_REQUEST, which covers both POST and GET, to using either-or. good luck! |
Re: Linking Using Php by paulomx: 3:46pm On Dec 08, 2009 |
$_REQUEST is beter in real time development u hardly see $_GET cos of input data privacy, |
Re: Linking Using Php by DualCore1: 5:22pm On Dec 08, 2009 |
Yawa I dont see how your solution will work for this guy o. From what I am understanding from his first post, he wants the value of a variable in index.php to be transfered to friend.php. Well i just work up and i'm still seeing double but here is what I am thinking should work as a solution. Index.php <?php friend.php <?php |
Re: Linking Using Php by yawatide(f): 6:23pm On Dec 08, 2009 |
Well, there is more than 1 way to skin a cat. Your solution works too. Of course, the argument now, given the original post, becomes which method is more efficient. that, I will leave for the pros to answer |
(1) (Reply)
My Images Dont Appear On Dreamweaver, Help Nairalanders / Pls Help With Joomla Software / Banning Users On Niraland
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 17 |