GET vs SUBMIT Button to show sections on one index.php page?
Posted on
16th Feb 2014 07:03 pm by
admin
Just curious if one of these ways is better (i.e. more efficient) than the other.
I have an index.php page where there is a menu across the top with 5 choices. For example, HOME | MONKEYS | CATS | DOGS | KANGAROOS.
Did you know?Explore Trending and Topic pages for more stories like this.
I have ALL the code for those 5 pages on that single index.php file. Now is it better to...
1. Use FORM SUBMIT BUTTONS for each menu option. So I'd have the action of the form be "index.php" and then code like this for the menu...
Code: <input type='submit' name='submit' value='HOME' ><input type='submit' name='submit' value='MONKEYS' >
And then I would have IF statements to see which Submit button was clicked and show the right info accordingly.
OR
2. Use appended URLs and then use GET to see which info should show, as in...
Code: <a href="index.php?page=home">HOME</a>|<a href="index.php?page=monkeys">MONKEYS</a> (etc, etc)
And then have IF statements using GET to check the URL and show the right info accordingly.
I'm not sure one way is better than the other, but just curious if anyone has any thoughts. Like maybe one of these processes in more server intensive than the other??
NOTE: If I use Google Analytics, I guess might help to see appended URLs to know which page got more hits, rather than just seeing info for index.php without knowing if they visited MONKEYS, or CATS or whatever. But please answer the question as if Google Analytics was not relevant.
Thanks
No comments posted yet
Your Answer:
Login to answer
316
33
Other forums
Help with ORDER BY
Hello. I would like to order by ascending States, then Cities, then Gyms in the following code, but
session variables not working anymore
hello,
i use sessions to handle authentication within my site. my host has been changing a lot of
session_destroy();
new to php
I have a simple login and am trying to write a logout.
I set a $_SESSION var to 1 i
XML Grouping
I'm using xml_parse_into_struct to get all my elements, but now I need to group them. For example, h
highlighting search terms
well, I started this in the regular PHP section, but it no longer fits there. Suffice it to say, I'm
Php If in MySql query (hiding labels if a field is empty)
Okay, I've been trying to do this for a while, and I'm finally going to ask for help so I can get th
ok i need to join all this pages to make 1 neat code
i have 5 pages that make up my tv guide it works 100% but i want to make it 1 page if i can or 2, i
PHP Surveys
I really would like some advice.
If you have a client come to you asking for a survey to be d
Rounding a number queried from a database
I know that to display a rounded number you just do echo "round($number)";. But how would
Unique Visitor Tracking
Hello. Currently, I run a voting site where voters are tracked by their IP address and can only vote