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?
| |
|
Welcome to KnowledgeSutra - Dear Guest | |
Php Help Please
Started by loc, Aug 13 2004 10:01 PM
4 replies to this topic
#2
Posted 13 August 2004 - 10:10 PM
Unless you are using POST requests in forms, you can access it with the $_GET array. With the ranks example:
You may have to use $_POST instead of $_GET if you're using the POST method to submit data.
<?php[br]if ($_GET['view'] == 'Ranks')[/br]{[br]// display the ranks page[/br]}[br]else[/br]{[br]// other code goes here[/br]}
?>
You may have to use $_POST instead of $_GET if you're using the POST method to submit data.
#5
Posted 10 December 2007 - 08:15 PM
You don't need a $_GET to pass parameters, or a form, you can use a simple link like this:
And then, the results.php page:
It works for me!
<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:
<?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!
Edited by acantocephala, 10 December 2007 - 08:18 PM.
Reply to this topic

1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users














