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>"; } } Quote Link to comment 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. Quote Link to comment 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... Quote Link to comment Share on other sites More sharing options...
Readme Posted May 19, 2013 Author Share Posted May 19, 2013 Someone... Quote Link to comment 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. Quote Link to comment 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.