Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send Data using address

Status
Not open for further replies.

WJProctor

Programmer
Joined
Jun 20, 2003
Messages
151
Location
GB
Hi, im trying to send a command using the address for example

localhost/install.php?Do=Load

thing is php wont seem to do it for me, maybe im just being daft or something, could someone have a look please??

The code is as follows

<?
$Style = urlencode(&quot;Address&quot;);
print(&quot;<a href='SiteMap.php?Order=$Style'>Order by Address</a>&quot;);
print(&quot;<BR>&quot;);
$Style = urlencode(&quot;Description&quot;);
print(&quot;<a href='SiteMap.php?Order=$Style'>Order by Description</a>&quot;);
?>

then on SiteMap.php

if ($Order==&quot;Description&quot;){
$Site = mysql_query('SELECT * FROM siteindex ORDER BY Description', $db);
} else {
$Site = mysql_query('SELECT * FROM siteindex ORDER BY Address',$db);
}

but it doesnt register the value of Order.

Regards

JP
 
Agree with Sleipnir214 but occasionally , regexp does what you least expect. From a coding point of view (and resilience), I prefer switch for things like this, as adding more options and even having a default are nice.:
(to make it active , remove the double quotes and echo statements - these are there purely to demonstarte that the switch() correctly assembles the mysql queries.

Code:
switch(true){
		case preg_match('/Description/i',$Order) :
	 		$Site = &quot;mysql_query('SELECT * FROM siteindex ORDER BY Description', $db)&quot;;
			echo $Site;
		break;

       	case preg_match('/Address/i',$Order) :
       	 	$Site = &quot;mysql_query('SELECT * FROM siteindex ORDER BY Address', $db)&quot;;
	   		echo $Site;
		break;

		default :
			$Site = &quot;mysql_query('SELECT * FROM siteindex', $db)&quot;;
			echo $Site;
		}

______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top