![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Sep 2005
Location: Omaha, NE
Posts: 8
Rep Power: 0
![]() |
Sending parameters through anchor tags?
Hi,
I'm making a site with php and I'm not sure if what I'm trying to do is possible. What I have is a navigation menu with links to a php file that searches an sql table for matching parameters. Is there a way to attach the element to search for to the end of the url or another way to do that? Not sure if I explained that correctly ![]() |
|
|
|
|
|
#2 |
|
Expert Programmer
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4
![]() |
do you mean passing parameters in an url? You can do this as url:
somepage.php?parameter1=value¶meter2=anothervalue¶meter3 =etc and this is how to get the parameters in somepage.php: <?php $param1 = $_GET['parameter1'] // $param1 contains now value $param2 = $_GET['parameter2'] // $param2 contains now anothervalue // the same counts for parameter3 ?> |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Sep 2005
Location: Omaha, NE
Posts: 8
Rep Power: 0
![]() |
Yeah, that's what I was looking for.
Thanks |
|
|
|
|
|
#4 |
|
Newbie
Join Date: Sep 2005
Posts: 1
Rep Power: 0
![]() |
If you have global variables turned on you can just call the parameter by its name.
eg somepage.php?parametername=1234 then php will automatically create a variable for the parameter <? echo $parametername; // this will display the value 1234 no need for $_GET ?> |
|
|
|
|
|
#5 |
|
Troll
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4
![]() |
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270 |
|
|
|
|
|
#6 |
|
Professional Programmer
|
Even without, if you switch to a server without global vars it can be a pain (you an turn them back on with a .htaccess file, but still like you said security issues). It's also considered sloppy code when you write it like that.
BTW, good to see another wings fan. |
|
|
|
|
|
#7 |
|
Newbie
Join Date: Sep 2004
Posts: 23
Rep Power: 0
![]() |
don't forget to read about sql injection!
|
|
|
|
|
|
#8 |
|
Expert Programmer
|
Yeah there are quite a few vunerabilities you will need to check for. Check out www.securityfocus.com it says all the vunerabilities to different software, and how to fix them/exploit them.
__________________
Join us at #programmingforums @ irc.freenode.net! My software never has bugs. It just develops random features.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|