Jump to content

[SOLVED] how to get information from url


cs1h

Recommended Posts

Hi,

 

I am using the get method on my form to send information to my proccesing script, but i don't know how to take the information from the url and so that i can search for it in the database using a piece of code like this,

$sql = "SELECT * FROM items WHERE id=$art";

 

Can any one tell me how to do this,

 

Cheers

Colin

Link to comment
https://forums.phpfreaks.com/topic/69911-solved-how-to-get-information-from-url/
Share on other sites

url example

<?php
example.php?id=$art
?>

 

<?php
if($_GET['id']=="$art"){

$x = $_GET['art'];

$sql = "SELECT * FROM `items` WHERE id='$x'";

$results = mysql_query($sql) or die(mysql_error());

// echo required info.

}else{

header("location: index.php");

exit;

}
?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.