$username Posted November 29, 2007 Share Posted November 29, 2007 Hello PHPers I am working on making a drop down box with in my PHP echo. Can some let me know if this is right? echo ("<td><select name=\'WebCaseTypeSet'>".$no_opt. "</option>" .$yes_opt. "</option></select><big></big></td>"); Link to comment https://forums.phpfreaks.com/topic/79362-solved-setting-up-html-in-php-echo/ Share on other sites More sharing options...
revraz Posted November 29, 2007 Share Posted November 29, 2007 Your first OPTION shouldn't have a backslash in it. Link to comment https://forums.phpfreaks.com/topic/79362-solved-setting-up-html-in-php-echo/#findComment-401772 Share on other sites More sharing options...
$username Posted November 29, 2007 Author Share Posted November 29, 2007 Here is my revised code echo ("<td><select name=\"WebCaseTypeSet\">".$no_opt. "</option>" .$yes_opt. "</option></select><big></big></td>"); I also have this that is doing to MYSQL work $sql202 = "SELECT WebID, WebCasesType, WebCaseTypeSet FROM webdisplay"; $query202 = mysql_query($sql202); while($row202 = mysql_fetch_array($query202)) { $no_opt = '<option value="No" '; $yes_opt = '<option value="Yes" '; if ($row202["WebCaseTypeSet"] == "No") $no_opt .= 'selected=selected'; else $yes_opt .= 'selected=selected'; $no_opt .= '>'; $yes_opt .= '>'; Link to comment https://forums.phpfreaks.com/topic/79362-solved-setting-up-html-in-php-echo/#findComment-401774 Share on other sites More sharing options...
emehrkay Posted November 29, 2007 Share Posted November 29, 2007 you should try to indent your html so that you can easily see your mistakes echo "<td> <select name=\"WebCaseTypeSet\"> ".$no_opt. "</option> " .$yes_opt. "</option> </select> <big></big> </td>"; That clearly isnt correct html formatting. You do not have opening tags for your options. and is big a tag? Link to comment https://forums.phpfreaks.com/topic/79362-solved-setting-up-html-in-php-echo/#findComment-401777 Share on other sites More sharing options...
$username Posted November 29, 2007 Author Share Posted November 29, 2007 In the code I have the $no_opt = '<option value="no" '; $no_opt = '<option value="No" '; $yes_opt = '<option value="Yes" '; Link to comment https://forums.phpfreaks.com/topic/79362-solved-setting-up-html-in-php-echo/#findComment-401778 Share on other sites More sharing options...
$username Posted November 29, 2007 Author Share Posted November 29, 2007 I got it it was my mistake echo "<td> <select name=\"WebCaseTypeSet\"> ".$no_opt. "[b]No[/b]</option> " .$yes_opt. "[b]Yes[/b]</option> </select> <big></big> </td>"; Link to comment https://forums.phpfreaks.com/topic/79362-solved-setting-up-html-in-php-echo/#findComment-401781 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.