ebchost Posted January 1, 2012 Share Posted January 1, 2012 I try somthing like this, but i have problem <?php $path = $_SERVER['DOCUMENT_ROOT']; $path .= "/resources/init.php"; include_once($path); $formacije = "SELECT * FROM `man_formacije` ORDER BY `id` ASC"; $rezultati = mysql_query($formacije) or die (mysql_error()); $dropdown = "<select name='formacija'>"; ?> <select> <?php while($row = mysql_fetch_array($rezultati)) { $id = $row['id']; $naziv = $row['naziv']; $meta = $_GET['id']; ?> <option value="<?php echo $id; ?>"><?php echo $naziv; ?></option> <?php } ?> </select> <?php if($meta) { echo "<br> $id"; } else echo "error"; ?> I have error message, or if i put ($meta = $_GET['id'] part of code, below select (combo box) i have echo 20 how to echo (or get) corect value of selctet data from combo box ? Link to comment https://forums.phpfreaks.com/topic/254163-echo-get-data-from-combo-box/ Share on other sites More sharing options...
scootstah Posted January 1, 2012 Share Posted January 1, 2012 You need to give your <select> a name, and then access it from the $_POST superglobal. So like echo $_POST['selectname']; Link to comment https://forums.phpfreaks.com/topic/254163-echo-get-data-from-combo-box/#findComment-1303112 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.