Re: [PHP] Extracting Variables From URL
I think you should try: http://php.net/parse_url greets Zoltán Németh 2007. 05. 16, szerda keltezéssel 19.40-kor CK ezt írta: Hi All, The following code works just fine for outputting links from an array. The next goal, is parsing the $thisPage variable from the URL (http://bushidodeep.com/contact.html/) so as ?php $thisPage=strtolower(contact);?, this variable could also be assigned to the $links[] $key. Moving to a dynamic link generator class, what PHP function(s) could be used to parse the URL? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / titleGenerate Links/title ?php $thisPage=strtolower(contact); ? /head body ?php $links=array(Home,Work,Contact); $count =0; echo ul id=\navlist\ \n; foreach($links as $key){ if(strtolower($key)!= $thisPage){ echo (lia href=\./$key\ tabindex=\$count;\ title=\link to $key\$key/a/li\n); $count ++; }else{ echo (li id=\current\$key/li); } } echo /ul \n; /*prints key as tabindex.. $links=array(home,work,contact); $count =0; echo ul id=\navlist\ \n; foreach($links as $key){ echo (lia href=\./$key\ tabindex=\$count;\ title=\link to $key\$key/a/li\n); $count ++; } echo /ul \n; */ ? !--a href= tabindex= title=/a-- /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Extracting Variables From URL
http://www.php.net/reserved.variables use $_SERVER['PHP_SELF'] or $_SERVER['REQUEST_URI'] just parse its value to get what you needed. hth, John On 5/17/07, CK [EMAIL PROTECTED] wrote: Hi All, The following code works just fine for outputting links from an array. The next goal, is parsing the $thisPage variable from the URL (http://bushidodeep.com/contact.html/) so as ?php $thisPage=strtolower(contact);?, this variable could also be assigned to the $links[] $key. Moving to a dynamic link generator class, what PHP function(s) could be used to parse the URL? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / titleGenerate Links/title ?php $thisPage=strtolower(contact); ? /head body ?php $links=array(Home,Work,Contact); $count =0; echo ul id=\navlist\ \n; foreach($links as $key){ if(strtolower($key)!= $thisPage){ echo (lia href=\./$key\ tabindex=\$count;\ title=\link to $key\$key/a/li\n); $count ++; }else{ echo (li id=\current\$key/li); } } echo /ul \n; /*prints key as tabindex.. $links=array(home,work,contact); $count =0; echo ul id=\navlist\ \n; foreach($links as $key){ echo (lia href=\./$key\ tabindex=\$count;\ title=\link to $key\$key/a/li\n); $count ++; } echo /ul \n; */ ? !--a href= tabindex= title=/a-- /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- GMail Rocks!!!
RE: [PHP] Extracting Variables
-Original Message- From: Steve Buehler [mailto:[EMAIL PROTECTED]] Sent: 13 June 2002 15:54 I hope that someone will be kind enough to help me on this. snip I want to do something like the following, but it does not work: testinput(); function testinput(){ GLOBAL $HTTP_POST_VARS; extract($HTTP_POST_VARS); echo i = $ibr; for($c=1;$c=$i;$c++){ echo team_number $team_number_$cbr; echo sub1_$c = $sub1_$cbr; echo sub2_$c = $sub2_$cbr; echo sub3_$c = $sub3_$cbr; echo sub4_$c = $sub4_$cbr; echo sub5_$c = $sub5_$cbr; } } I don't think you can do this directly in a single string (at least, I haven't been able to!). However, either of the following formats should work for you: echo sub1_$c = . ${sub1_$c} . 'br'; echo sub1_$c = . ${'sub1_'.$c} . 'br'; But -- erm -- can I just ask why you're not using arrays, which might make life somewhat easier?! Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Extracting Variables
echo i = $ibr; for($c=1;$c=$i;$c++){ echo team_number $team_number_$cbr; echo sub1_$c = $sub1_$cbr; echo sub2_$c = $sub2_$cbr; echo sub3_$c = $sub3_$cbr; echo sub4_$c = $sub4_$cbr; echo sub5_$c = $sub5_$cbr; } } Perhaps this: Echo sub1_$c = $sub1_$c[$c]; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php