Click to See Complete Forum and Search --> : help for school project


barantamer
05-06-2007, 05:17 AM
hello ,
i am making a website for my school project ,
i am using php and mysql.
project is about sports information system .

i have almost completed the design but i am having some difficulties .

i put some buttons to the left side and named them , football, basketball,etc .. and some buttons to the top and named them world records , world standings , etc.... i want the user first select the sport name (ex . click the football button ) and then by clicking the world record button , user should see world records about football .
How can i make this happen ?
i thought about having a valid tuple in the database , and making that row 1 when a sport is clicked , and making the rest 0 . However this is not an efficient way .. any suggestions ?

JayM
05-06-2007, 10:05 AM
You can pass variables through the query string. So the football button can link to page.php?sport=football

On that page, you will have the world record buttons, where the user can click them and you can retrieve information regarding that sport.


//retrieve the type of sport that user wants to see
$sport = $_GET['sport'];

$sport_query = "SELECT * FROM tblWordRecords WHERE sport = $sport"



The above is just a quick example on how to do it. One quick note is that you should be concerned about passing values through the query string as a user can easily alter them, so as a general practice you should add slashes to your code before querying the database.