Readme Posted May 19, 2013 Share Posted May 19, 2013 This functions used select data but I want use <input type="checkbox"/> Please help to modify. //----------get country via select option---------- function get_country() { $sql = "SELECT id,country FROM countries ORDER BY id ASC"; $res = mysql_query($sql); echo "<select id=\"country\" class=\"searchbox\" name=\"country\">"; echo "<option value=\"\">Select One</option>"; while ($row = mysql_fetch_assoc($res)){ echo "<option value=\"".$row['country']."\">".$row['country']."</option>"; } echo "</select>"; } //----------get countries via select option from users---------- function get_select_countries($id) { $id = secureInput($id); $sql = "SELECT country FROM countries ORDER BY country ASC"; $res = mysql_query($sql); $sql1 = "SELECT country FROM users WHERE id='".$id."'"; $res1 = mysql_query($sql1); $row1 = mysql_fetch_assoc($res1); if($row1){ echo "<select name=\"country\">"; echo "<option selected=".$row1['country']." value=\"".$row1['country']."\">".$row1['country']."</option>"; while ($row = mysql_fetch_assoc($res)){ echo "<option value=\"".$row['country']."\">".$row['country']."</option>"; } echo "</select>"; } else { echo "<select name=\"country\">"; while ($row = mysql_fetch_assoc($res)){ echo "<option value=\"".$row['country']."\">".$row['country']."</option>"; } echo "</select>"; } } Link to comment https://forums.phpfreaks.com/topic/278160-select-make-checkbox/ Share on other sites More sharing options...
cpd Posted May 19, 2013 Share Posted May 19, 2013 Remove the "<select..." parts and in the while loop alter the "<option..." to be an input of type checkbox - really isn't that hard. Link to comment https://forums.phpfreaks.com/topic/278160-select-make-checkbox/#findComment-1430948 Share on other sites More sharing options...
Readme Posted May 19, 2013 Author Share Posted May 19, 2013 Not work or I make something wrong One checkbox coming up... Link to comment https://forums.phpfreaks.com/topic/278160-select-make-checkbox/#findComment-1430955 Share on other sites More sharing options...
Readme Posted May 19, 2013 Author Share Posted May 19, 2013 Someone... Link to comment https://forums.phpfreaks.com/topic/278160-select-make-checkbox/#findComment-1431066 Share on other sites More sharing options...
Jessica Posted May 19, 2013 Share Posted May 19, 2013 Don't bump your posts. Post your updated code. Link to comment https://forums.phpfreaks.com/topic/278160-select-make-checkbox/#findComment-1431071 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.