Jump to content
Larry Ullman's Book Forums

roberts

Members
  • Posts

    3
  • Joined

  • Last visited

roberts's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hey Guys, First of all thanks for the replies. Second of all, I think you've misunderstood what I am trying to do. What I am trying to do is create a drop down menu that would have 3 options: All employee, Chefs and Waiters. When Chefs and Waiters are selected the data is fetched from a database that would display the selected option in a table, now this works great. The problem lays with the All employee option which should fetch both Chefs and Waiters data and display it in a form. I hope that explains my problem in better detail. I am also using $_GET and not $_POST. Further code on how i get the selected option to be run if (isset($_GET['check_request'])) { $required=array(); $sea=false; if(isset($_GET['sea']) && $_GET['sea'] == NULL){ $required[]='You are required to select!'; } else { $sea= trim($_GET['sea']); } if (empty($required)) { require('connection.php'); $query = "SELECT empl_id, year, position, name, yel, rel FROM played WHERE empl_id=? AND position=? AND year=? AND (yel=? OR rel=?) ORDER BY name DESC"; Thanks in advance
  2. Sorry Paul, I don't quite understand your suggestion. Could you give a more simplified example please.
  3. Hey Guys! I've ran into a little problem and I've become confused and its doing my head in, even though I consider it as something trivial. My problem is that I'm creating a drop down menu, but would like to have an 'All' option, that would display all the results from the other options (fetches the required data from the database). I've practically ran out of ideas and I would like to here what you guys could suggest. Thanks in advance! PHP Code: <select name="season"><?php $physios=array( "All" => "All employees", "Chefs" => "Chefs", "Wait" => "Wait" ); foreach ($physios as $v => $d) { print "<option value=\"$v\""; if (isset($_GET['sea']) && $_GET['sea'] == $v) { print ' selected="selected"'; } print ">$d</option>\n"; } ?></select> SQL Query: $query = "SELECT empl_id, year, position, name, yel, rel FROM played WHERE empl_id=? AND position=? AND year=? AND (yel=? OR rel=?) ORDER BY name DESC";
×
×
  • Create New...