Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Php Help Please


4 replies to this topic

#1 loc

    Member [Level 2]

  • Kontributors
  • PipPipPipPipPip
  • 78 posts

Posted 13 August 2004 - 10:01 PM

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?

#2 Gamesquare

    Newbie [Level 3]

  • Kontributors
  • PipPipPip
  • 45 posts

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:

<?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.

#3 rigueira

    Newbie [Level 2]

  • Kontributors
  • PipPip
  • 28 posts

Posted 27 November 2007 - 01:50 AM

the only way to use method POST is using FORM?

The method GET can be used like a simple link, didn't it?

#4 gogoily

    Member [Level 3]

  • Kontributors
  • PipPipPipPipPipPip
  • 99 posts

Posted 06 December 2007 - 04:27 AM

I'm not sure what's your mean
But if you wanna get parameters that after ".php?", you should use $_GET

#5 acantocephala

    Newbie [Level 1]

  • Kontributors
  • Pip
  • 24 posts
  • Gender:Male
  • Location:Spain
  • myCENT:79.61

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:


<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


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users