...

View Full Version : passing values to query databases



nickyfraggle
10-30-2006, 09:22 AM
Hello,

I'm trying to query a database using values passed from a form (user input). Usually I do this using an input box, a jump menu or something similar...using the post method to get the values.

Is it possible to have an <li> pass a value which I can then use to query my database? What I'd really like to do is have a 'newsflash' on a home page. Each link would be a <li> list item, and would link to a specific page, e.g news.php. News.php would query the database using the value from the <li> and only output the information relevant to that headline. This way each headline links to the same page, but outputs different information!

Does anyone know if this is possible? Or you might even have a better way of accomplishing the same thing?

Thanks a lot!

Nicky

Sayonara
10-30-2006, 11:18 PM
Is it possible to have an <li> pass a value which I can then use to query my database? What I'd really like to do is have a 'newsflash' on a home page. Each link would be a <li> list item, and would link to a specific page, e.g news.php.

Your two options here are to pass the value for the query as part of the URL on the link, or if you want to use forms then include a hidden field in each <li />.

nickyfraggle
10-31-2006, 11:05 AM
Your two options here are to pass the value for the query as part of the URL on the link, or if you want to use forms then include a hidden field in each <li />.

So...do you mean having something like www.mydomain.com/article.php?article=news1

Does this automatically query my database, or would I need some other code?

I'm not sure how the hidden field in the <li> would work. Would I automatically submit it on click?

Thanks very much for your help. Personally I think the first method is clearer, but as I'm learning I'd like to understand how both work.

Thanks,

Nicky



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum