Re: Links and Logic

From: Date: Mon, 28 Aug 2000 06:37:11 +0000
Subject: Re: Links and Logic
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-13905@lists.php.net to get a copy of this message
On 28 Aug, Barry Young wrote: > Being new to PHP3 and MySQL, I think I have some problems with the logic > involved in the creation of hyperlinks. > > Example: I can produce a table containing the first 10 items, from a SQL > query, and make them links using their unique ID, ie > > print ("<tr bgcolor=#999999>"); > print ("<td> <font face=Verdana, Arial, Helvetica, sans-serif size=4 > color=#FFFFFF>"); > print (" "); > print ("<a href= http://xxx.com/data/"); > print $row["id"]; > print (">"); > print $row["make"]; > print (" "); > print $row["model"]; > print (" "); > print ("<br>"); > print $row["description"]; > print ("</font>"); > print ("</td>"); > print ("</tr>"); > > > but how do you construct a script that recognises the hyperlink > (http://www.xxx.com/data/23) as being item 23, and construct a page with the > info about item 23(from the database) in it? > > Any ideas or links would be appreciated. > You need to pass a value by name so that you can access it as a variable in the called script. So you need to make your URL of the form: http://www.domain.name/dir/script.php?name=value where name will be the variable mname to access and value will be the (urlencoded if needed) value of that variable. Then in the subsequent script you can construct a sql query based on (in this case) that value as a unique ID. Cheers -- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA

« previous php.general (#13905) next »