Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Php Help Please, ^.^
loc
post Aug 13 2004, 10:01 PM
Post #1


Member [Level 2]
*****

Group: Members
Posts: 78
Joined: 6-August 04
Member No.: 694



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?
Go to the top of the page
 
+Quote Post
Gamesquare
post Aug 13 2004, 10:10 PM
Post #2


Newbie [Level 3]
***

Group: Members
Posts: 45
Joined: 4-August 04
Member No.: 667



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.
Go to the top of the page
 
+Quote Post
rigueira
post Nov 27 2007, 01:50 AM
Post #3


Newbie [Level 2]
**

Group: Members
Posts: 28
Joined: 25-November 07
Member No.: 53,723



the only way to use method POST is using FORM?

The method GET can be used like a simple link, didn't it?
Go to the top of the page
 
+Quote Post
gogoily
post Dec 6 2007, 04:27 AM
Post #4


Member [Level 3]
******

Group: Members
Posts: 99
Joined: 30-October 05
Member No.: 13,571



I'm not sure what's your mean
But if you wanna get parameters that after ".php?", you should use $_GET
Go to the top of the page
 
+Quote Post
acantocephala
post Dec 10 2007, 08:15 PM
Post #5


Newbie [Level 1]
*

Group: Members
Posts: 22
Joined: 1-April 07
From: Spain
Member No.: 40,913



You don't need a $_GET to pass parameters, or a form, you can use a simple link like this:


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!

This post has been edited by acantocephala: Dec 10 2007, 08:18 PM
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

 



- Lo-Fi Version Time is now: 12th October 2008 - 03:33 PM