ecabrera Posted December 15, 2011 Share Posted December 15, 2011 how do i make it so that all the items appear on eventname <?php require "scripts/connect.php"; $query = mysql_query("SELECT eventname FROM events"); while ($row = mysql_fetch_array($query)){ $eventname = $row['eventname']; $form = "<form action='addcat.php' method='post'> <table> <tr> <td>SELECT EVENT</td> <td> <select value='$eventname'> <option value='$eventname'>$eventname</option> </select> </td> </tr> <tr> <td>SELECT VENUE</td> <td> <select> <option></option> </select> </td> </tr> <tr> <td>SELECT CATEGORY</td> <td> <select> <option>FOOTBALL</option> <option>BASKETBALL</option> <option>HOCKEY</option> <option>DRAMA</option> <option>MUSIC</option> <option>DANCE</option> <option>VISUAL ARTS</option> </select> </td> </tr> </table> </form>"; echo "$form"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/253271-selection/ Share on other sites More sharing options...
scootstah Posted December 16, 2011 Share Posted December 16, 2011 Come on, did you even try? Quote Link to comment https://forums.phpfreaks.com/topic/253271-selection/#findComment-1298337 Share on other sites More sharing options...
ecabrera Posted December 16, 2011 Author Share Posted December 16, 2011 yes but it doesnt work i dont hat else to do Quote Link to comment https://forums.phpfreaks.com/topic/253271-selection/#findComment-1298341 Share on other sites More sharing options...
scootstah Posted December 16, 2011 Share Posted December 16, 2011 I'll give you a hint: $events = ''; while ($row = mysql_fetch_array($query)){ $events .= '<option value="' . $row['eventname'] . '">' . $row['eventname'] . '</option>'; } Quote Link to comment https://forums.phpfreaks.com/topic/253271-selection/#findComment-1298349 Share on other sites More sharing options...
ecabrera Posted December 16, 2011 Author Share Posted December 16, 2011 it triples my tables Quote Link to comment https://forums.phpfreaks.com/topic/253271-selection/#findComment-1298353 Share on other sites More sharing options...
scootstah Posted December 16, 2011 Share Posted December 16, 2011 Because you have the tables inside the while loop. Quote Link to comment https://forums.phpfreaks.com/topic/253271-selection/#findComment-1298355 Share on other sites More sharing options...
ecabrera Posted December 16, 2011 Author Share Posted December 16, 2011 thanks it works but what does .= mean you i know that what '. .' means but not .= is it need for this Quote Link to comment https://forums.phpfreaks.com/topic/253271-selection/#findComment-1298357 Share on other sites More sharing options...
scootstah Posted December 16, 2011 Share Posted December 16, 2011 It means "append the stuff on the right to the variable on the left". $foo = 'foo'; // $foo is "foo" $foo .= 'bar'; // $foo is "foobar" Quote Link to comment https://forums.phpfreaks.com/topic/253271-selection/#findComment-1298359 Share on other sites More sharing options...
ecabrera Posted December 16, 2011 Author Share Posted December 16, 2011 thanks Quote Link to comment https://forums.phpfreaks.com/topic/253271-selection/#findComment-1298361 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.