For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > January 2005 > HELP!!!









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author HELP!!!
Shaun Rigby

2005-01-09, 3:56 pm

how do i define a php variable using html?
i want to set an shtml page as a page with links to products - when each
button is pressed it it sets the product_category variable and lists all
entries with this variable - how do i set the html link to set the
variable?? wat do i need to set the product_category to?


Alan Cole

2005-01-09, 3:56 pm

In article <XicEd.86810$Z7.53841@fe2.news.blueyonder.co.uk>,
"Shaun Rigby" <shaunrigby16@hotmail.com> wrote:

> how do i define a php variable using html?
> i want to set an shtml page as a page with links to products - when each
> button is pressed it it sets the product_category variable and lists all
> entries with this variable - how do i set the html link to set the
> variable?? wat do i need to set the product_category to?


Just put the variable in the link.
i.e

<a href="filename.php?product_category=CATEGORY_HERE">Category</a>

The php file that the link points to will then use the $product_category
variable within a SELECT statement to get all the products within the
category and display them as a list (or however you wish to display
them).

Al.

--
Alan Cole. E-mail: justal at lineone dot net
http://www.forces-of-nature.co.uk [Coastal Sports]
http://www.tsunami-site-design.co.uk [Website Design]
http://tinyurl.com/64xrd [Plusnet ISP]
Lāʻie Techie

2005-01-15, 8:56 am

On Sun, 09 Jan 2005 16:24:41 +0000, Alan Cole wrote:

> In article <XicEd.86810$Z7.53841@fe2.news.blueyonder.co.uk>,
> "Shaun Rigby" <shaunrigby16@hotmail.com> wrote:
>
>
> Just put the variable in the link.
> i.e
>
> <a href="filename.php?product_category=CATEGORY_HERE">Category</a>
>
> The php file that the link points to will then use the $product_category
> variable within a SELECT statement to get all the products within the
> category and display them as a list (or however you wish to display them).
>
> Al.


This is true ONLY IF register_globals is turned on (a noted security
hole). Instead, access the $_REQUEST array. You may need to strip the
slashes depending on your php.ini settings.

$category = $_REQUEST['product_category'];

As always, you need to "clean" or "untaint" any data submitted by the
client.

HTH,
La'ie Techie

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com