Page 1 of 1

Code working in Firefox but not in IE

Posted: Thu Mar 09, 2006 5:31 pm
by keveh
Hi there,

I am working on some code which will search my forums for a users ID.

The following code works fine with firefox, you search for a name, that appears in the drop down box, then it shows an id number in an input box.

For some reason, when used in IE and Safari, the drop down list box part doesn't work. It doesn't display any names in the box at all.

If anybody know's where I'm going wrong I'd be very grateful

Code: Select all

<table width="300" border="0">
	<tr>
		<td width="150" valign="top">
			<font face="arial" size="1">
			<form name="authsearch" method="post" action="auth_search.php">
				<input type="hidden" name="actionflag" value="authname">
				Search for Username:<br />
				<input type="text" size="20" name="author" class="auth_input">

				<input type="submit" value="search" class="auth_input">
			</form>
			</font>
		</td>
		<td width="150" valign="top">
			<font face="arial" size="1">
			<?php
				if( isset($actionflag) && $actionflag == "authname"){
			?>
				<form name="authselect" method="post" action="auth_search.php">
				<input type="hidden" name="actionflag" value="authselect">
				<select name="authresult" class="auth_input">
			<?php
				$sql = "SELECT * FROM phpbb_users WHERE username LIKE '%$author%'";
				$result = mysql_query ( $sql, $link2 );
				if(!$result){
					die ( "addfeature error: ".mysql_error() );
				}

				while ($auth_row = mysql_fetch_array($result)){
					echo ( '<option" value="' . $auth_row[user_id] . '">' . $auth_row[username] .'</option>' );
				}

			?>
				</select>
				<input type="submit" value="select" class="auth_input">
				</form>
			<?php
			}

				if( isset($actionflag) && $actionflag == "authselect"){
					$sql = "SELECT username FROM phpbb_users WHERE user_id = '$authresult'";
					$result = mysql_query ( $sql, $link2 );
					$name = mysql_fetch_array ($result);
					echo ( 'User ID for ' . $name[username] . ': <br><input type="text" value="' .$authresult. '" size="5" class="auth_input">');
				}
			?>
			</font>
		</td>
	</tr>
</table>

Posted: Fri Mar 10, 2006 12:54 am
by tmarion
IE/Firefox/ETC does not care about PHP code. The problematic code is your HTML. All of the PHP processing in the backend in the end returns the html code to handoff to the browser. I would suggest validating this page @ w3c http://validator.w3.org/ If the page is valid then it should display properly in almost all browsers. Good Luck!

http://www.marionweb.com
-- Business solutions through technology

Posted: Fri Mar 10, 2006 1:25 am
by RobertGonzalez
You might also want to take a look at your CSS. There are many things that IE doesn't handle properly. I noticed your select tag has a CSS class assigned to it. Look at that more than anything else. Also, do a view source in IE to see what code the browser is seeing. If the open and close select form tags are there and there are options within the select tags, then I would guess it is a CSS thing.