| | I have noticed that when some people use links, they type in something like this *index.php?view=Ranks* or something like that. Can you tell me how to use the little addons that go after the .php? Or point me toward a good tutorial on the subject? |
|
|
Unless you are using POST requests in forms, you can access it with the $_GET array. With the ranks example:
CODE <?php if ($_GET['view'] == 'Ranks') { // display the ranks page } else { // other code goes here } ?> You may have to use $_POST instead of $_GET if you're using the POST method to submit data.
the only way to use method POST is using FORM?
The method GET can be used like a simple link, didn't it?
I'm not sure what's your mean
But if you wanna get parameters that after ".php?", you should use $_GET CODE <a href="results.php?criteria=searchField=A">Title with A</a> <a href="results.php?criteria=searchField=B">Title with B</a> <a href="results.php?criteria=searchField=C">Title with C</a> And then, the results.php page: CODE <?php ... $_connection ... ?> <head> <title>Books!</title> </head> <body> <?php $sql = "SELECT * FROM books WHERE $_REQUEST[criteria] like '$_REQUEST[searchField]%' ORDER BY title"; $result=mysql_query($sql); if (mysql_num_rows($result)) { while ($row=mysql_fetch_array($result)) { echo '<strong>'.$row["title"].'</strong>; } } else echo 'No records were found!'; ?> </body> </html> It works for me!
|
|
![]() Php Help Please - ^.^ |
| ADD REPLY / Got an Opinion! | a humble request :-) | RAPID SEARCH! | Free Hosting | [X] |
|
Express your Opinions, Thoughts or Contribute more info. to help others. Ask your Doubts & Queries to get answers, So that "Together We can help others!" |
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP. | 500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE |
|