timbradley Posted September 20, 2010 Share Posted September 20, 2010 Hi All! First post here - I'm a bit of a self taught PHP junkie I'm having some issues with the following php/MySQL code. The issue is with Internet Explorer (surprise, surprise) I have setup an if statement so that the long description field in the form comes up as a text area (based on the max-length property of the mySQL field.), while the shorter fields come up as text fields. The issue is that in IE, none of the shorter fields preceding the Long Description Text Field show up - ie. the form is lacking a couple of necessary fields. Works perfectly well in Firefox. <form id="addprod" name="addprod" action="" method="get" enctype="multipart/form-data"> <?php require_once($_SERVER['DOCUMENT_ROOT'].'/resources/db/viewer_connect.php'); $table = 'products'; $fieldQuery = "SELECT * from $table"; $result = mysql_db_query($dbname,$fieldQuery) or die('<span class="body_text">Query Error: '.mysql_error().'</span>'); $i = 0; $prInfo = array('PROD_ID'=>'Product ID', 'PROD_NAME'=>'Product Name', 'PROD_DESC_SHORT'=>'Product Description (Short)', 'PROD_DESC_LONG'=>'Product Description (Long)', 'MODEL_1'=>'Model 1', 'MODEL_2'=>'Model 2', 'MODEL_3'=>'Model 3', 'MODEL_4'=>'Model 4', 'MODEL_5'=>'Model 5', 'RRP_1'=>'Model 1 RRP($)', 'RRP_2'=>'Model 2 RRP($)', 'RRP_3'=>'Model 3 RRP($)', 'RRP_4'=>'Model 4 RRP($)', 'RRP_5'=>'Model 5 RRP($)', 'PROD_IMG'=>'Main Image', 'IMAGE_2'=>'Image 2', 'IMAGE_3'=>'Image 3'); while ($i < mysql_num_fields($result)) { $meta = mysql_fetch_field($result, $i); if (!$meta) { echo "No information available<br />\n"; } if($meta->max_length<=256){ if($meta->name=='PROD_IMG'||$meta->name=='IMAGE_2'||$meta->name=='IMAGE_3'){ echo '<p class="body_text"><label for="'.$meta->name.'">'.$prInfo[$meta->name].':<input name="'.$meta->name.'" type="file" size="50" maxlength="'.$meta->max_length.'" /></label></p>'; } else{ echo '<p class="body_text"><label for="'.$meta->name.'">'.$prInfo[$meta->name].':<input name="'.$meta->name.'" type="text" size="50" maxlength="'.$meta->max_length.'" /></label></p>'; } } else{ echo '<p class="body_text" style="line-height:150px; vertical-align:top;"><label for="'.$meta->name.'">'.$prInfo[$meta->name].':<textarea name="'.$meta->name.'" cols="50" rows="10" /></p>'; } $i++; } mysql_free_result($result); ?> <p class="body_text"><input type="submit" value="Add New Record" /><input type="reset" value="Clear Form" /></p> </form> Any thoughts would be awesome!! Thanks in advance, Tim Quote Link to comment https://forums.phpfreaks.com/topic/213857-internet-explorer-challenge/ Share on other sites More sharing options...
chintansshah Posted September 20, 2010 Share Posted September 20, 2010 Can you please check in db again for the size of description max_length. What is the max_length output when datatype is text? Quote Link to comment https://forums.phpfreaks.com/topic/213857-internet-explorer-challenge/#findComment-1113099 Share on other sites More sharing options...
btherl Posted September 20, 2010 Share Posted September 20, 2010 Can you give us the final HTML that works in Firefox but not IE? That's easier to work with than the php that generates it, seeing as it looks like an HTML interpretation issue. Quote Link to comment https://forums.phpfreaks.com/topic/213857-internet-explorer-challenge/#findComment-1113101 Share on other sites More sharing options...
timbradley Posted September 20, 2010 Author Share Posted September 20, 2010 Hey guys - thanks for the replies. The resulting HTML is as follows: <form id="addprod" name="addprod" action="" method="get" enctype="multipart/form-data"> <p class="body_text"><label for="PROD_ID">Product ID:<input name="PROD_ID" size="50" maxlength="8" type="text"></label></p> <p class="body_text"><label for="PROD_NAME">Product Name:<input name="PROD_NAME" size="50" maxlength="46" type="text"></label></p> <p class="body_text"><label for="PROD_IMG">Main Image:<input name="PROD_IMG" size="50" maxlength="10" type="file"></label></p> <p class="body_text"><label for="PROD_DESC_SHORT">Product Description (Short):<input name="PROD_DESC_SHORT" size="50" maxlength="79" type="text"></label></p> <p class="body_text" style="line-height: 150px; vertical-align: top;"><label for="PROD_DESC_LONG">Product Description (Long):<textarea name="PROD_DESC_LONG" cols="50" rows="10"></textarea></label></p> <p class="body_text"><label for="MODEL_1">Model 1:<input name="MODEL_1" size="50" maxlength="5" type="text"></label></p> <p class="body_text"><label for="RRP_1">Model 1 RRP($):<input name="RRP_1" size="50" maxlength="1" type="text"></label></p> <p class="body_text"><label for="MODEL_2">Model 2:<input name="MODEL_2" size="50" maxlength="5" type="text"></label></p> <p class="body_text"><label for="RRP_2">Model 2 RRP($):<input name="RRP_2" size="50" maxlength="1" type="text"></label></p> <p class="body_text"><label for="MODEL_3">Model 3:<input name="MODEL_3" size="50" maxlength="5" type="text"></label></p> <p class="body_text"><label for="RRP_3">Model 3 RRP($):<input name="RRP_3" size="50" maxlength="1" type="text"></label></p> <p class="body_text"><label for="MODEL_4">Model 4:<input name="MODEL_4" size="50" maxlength="6" type="text"></label></p> <p class="body_text"><label for="RRP_4">Model 4 RRP($):<input name="RRP_4" size="50" maxlength="1" type="text"></label></p> <p class="body_text"><label for="MODEL_5">Model 5:<input name="MODEL_5" size="50" maxlength="0" type="text"></label></p> <p class="body_text"><label for="RRP_5">Model 5 RRP($):<input name="RRP_5" size="50" maxlength="0" type="text"></label></p> <p class="body_text"><label for="IMAGE_2">Image 2:<input name="IMAGE_2" size="50" maxlength="18" type="file"></label></p> <p class="body_text"><label for="IMAGE_3">Image 3:<input name="IMAGE_3" size="50" maxlength="16" type="file"></label></p> <p class="body_text"><input value="Add New Record" type="submit"><input value="Clear Form" type="reset"></p> </form> Thanks in advance! Quote Link to comment https://forums.phpfreaks.com/topic/213857-internet-explorer-challenge/#findComment-1113113 Share on other sites More sharing options...
btherl Posted September 20, 2010 Share Posted September 20, 2010 I can see the earlier fields when viewing with IE 8, both with and without compatibility view. Maybe the styling is affecting it? Also which version of IE are you testing with? Quote Link to comment https://forums.phpfreaks.com/topic/213857-internet-explorer-challenge/#findComment-1113115 Share on other sites More sharing options...
timbradley Posted September 20, 2010 Author Share Posted September 20, 2010 Hmmm. I'm using IE8 on Windows Vista and Win 7. Will go back over the CSS and see if there's an issue there I can identify. cheers! Quote Link to comment https://forums.phpfreaks.com/topic/213857-internet-explorer-challenge/#findComment-1113117 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.