rio38 Posted December 17, 2008 Share Posted December 17, 2008 Sorry for the long example of code, but I have a form that displays and a submit button named "pass_submit". I check for isset($_POST['pass_submit'] when the form is submitted. The logic works correctly in FF, but not in IE. The isset fails every time and I just get teh form displayed again. I check for the value of isset and get nothing. <head> <title></title> <link rel="stylesheet" href="styles.css"> <style type="text/css"> <!-- .style1 {color: #FF0000} --> </style> </head> <body> <?php function imageResize($width, $height, $target) { //takes the larger size of the width and height and applies the formula accordingly...this is so this script will work dynamically with any size image if ($width > $height) { $percentage = ($target / $width); } else { $percentage = ($target / $height); } //gets the new value and applies the percentage, then rounds the value $width = round($width * $percentage); $height = round($height * $percentage); //returns the new sizes in html image tag format...this is so you can plug this function inside an image tag and just get the return "width=\"$width\" height=\"$height\""; } ?> <?php if(isset($_POST['pass_submit'])) { $username = $_GET['user']; $pass = $_POST['promopassworddl']; mysql_connect("xx.xxx.xxx.xx", "xxxx", "xxxxxxx"); mysql_select_db("xxxxxxx"); $result = mysql_query("SELECT * FROM promo WHERE user_name = '" . $username . "'"); $rs = mysql_fetch_array($result); if($rs['promopass'] == $pass) { $imageResult = mysql_query("SELECT * FROM images WHERE user_name = '" . $username . "'"); if(mysql_num_rows($imageResult) > 0) { $imageRS = mysql_fetch_array($imageResult); $bandimage = "FileProcessingScripts/PHP/UploadedFiles/" . $username . "/images/" . $imageRS['item']; }else{ $bandimage = "images/defaultimage.jpg"; } $bioResult = mysql_query("SELECT * FROM users WHERE user_name = '" . $username . "'"); if(mysql_num_rows($bioResult) > 0) { $bioRS = mysql_fetch_array($bioResult); $bandBio = $bioRS['bio']; $bandCity = $bioRS['city']; $bandState = $bioRS['state']; }else{ $bandBio = ""; $bandCity = ""; $bandState = ""; } ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <div align="center"> <table width="650"> <tr><td align="center" colspan="2"> <?php $imageResult = mysql_query("SELECT * FROM adbanners"); if(mysql_num_rows($imageResult) > 0) { $imageRS = mysql_fetch_array($imageResult); //Display banner image ?> <img src="image.php?width=650&height=60&image=/JavaPowUpload/FileProcessingScripts/PHP/UploadedFiles/adbanners/<?php echo $imageRS['item'] ?>"> <?php } ?> </td></tr> <tr> <td align="center" colspan="2"> <applet code="com.elementit.JavaPowUpload.Manager" archive="lib/JavaPowUpload.jar, lib/skinlf.jar" width="600" height="250" name="JavaPowUpload" id="JavaPowUpload" mayscript="true" alt="JavaPowUpload by www.element-it.com" VIEWASTEXT> <param name="Common.SerialNumber" value="12128542289149116165180165"> <param name="progressbar" value="true"> <param name="boxmessage" value="Loading JavaPowUpload Applet ..."> <!--URL pointing to the xml file containing the list of files and folders to download --> <?php echo "<param name='Download.DataURL' value='FileProcessingScripts/PHP/UploadedFiles/".$username."/promo/promo.xml'>"; ?> <param name="Common.SkinLF.ThemepackURL" value="lib/themepack.zip"> You need to have the Sun Microsystems Java Runtime Environment (JRE) software version at least 5 (1.5.0) or enable applets running at you browser! Click <a target="_blank" href="http://www.element-it.com/DetectJavaVersion.aspx" title="Check java file upload applet">here</a> to get help. </applet> </td> </tr> <tr><td align="center" colspan="2"> <?php $imageResult = mysql_query("SELECT * FROM bandbanners WHERE user_name = '" . $username . "'"); if(mysql_num_rows($imageResult) > 0) { $imageRS = mysql_fetch_array($imageResult); //Display banner image ?> <img src="image.php?width=650&height=60&image=/JavaPowUpload/FileProcessingScripts/PHP/UploadedFiles/<?php echo $username ?>/banners/<?php echo $imageRS['item'] ?>"> <?php } ?> </td></tr> <tr> <td colspan="2" align="center"> <table width="100%"><tr> <td width="150"> <?php //Display profile image $myimage = getimagesize($bandimage); $newsize = imageResize($myimage[0], $myimage[1], 100); ?> <img src="<?php echo $bandimage ?>" <?php echo $newsize ?>> </td> <td align="left" valign="top"> <?php echo $bandBio; ?> </td> </tr></table> </td></tr> </table></div></td> </tr> </table> <?php }else{ echo "<table width =\"100%\"><tr><td align=\"center\">"; echo "Password Invalid<br /><br />"; unset($_POST['promopassworddl']); echo "<a href=\"" . $_SERVER['PHP_SELF'] . "?user=" . $username . "'>Click Here To Try Again</a>"; echo "</td></tr></table>"; } }else{ $username = $_GET['user'];?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td> <div align="center"> <table id="Table_01" width="500" height="453" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="3"> <img src="images/headphones1_01.gif" width="500" height="217" alt=""></td> </tr> <tr> <td rowspan="2"> <img src="images/headphones1_02.gif" width="168" height="236" alt=""></td> <td background="images/headphones1_03.gif" width="158" height="104"> <form action="DownloadListFromScript.php?user=<?php echo $username ?>" method="post"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td><div align="center"> <span class="style1">Promo Password</span><br /> <input name="promopassworddl" type="password" size="15" maxlength="20"><br /><input type="submit" name="pass_submit" value="Download"></div></td> </tr> </table> </form></td> <td rowspan="2"> <img src="images/headphones1_04.gif" width="174" height="236" alt=""></td> </tr> <tr> <td> <img src="images/headphones1_05.gif" width="158" height="132" alt=""></td> </tr> </table> </div></td> </tr> </table> <?php } ?> </body> Link to comment https://forums.phpfreaks.com/topic/137371-_post-not-being-recognized-on-submit-of-form-in-ie/ Share on other sites More sharing options...
beansandsausages Posted December 17, 2008 Share Posted December 17, 2008 in your form fields use id="name" as well as name="name" also change post to POST Link to comment https://forums.phpfreaks.com/topic/137371-_post-not-being-recognized-on-submit-of-form-in-ie/#findComment-717736 Share on other sites More sharing options...
ILMV Posted December 17, 2008 Share Posted December 17, 2008 I believe the problem exists because when you are on a form (in IE) and you hit enter rather then submit, it doesn't fire the submit button, it just sends the variables to the action script. The fix for this is to add a hidden variable into your form, so no matter what happens (enter, return or submit button), 'pass_submit' is always sent. Add this... <input type='hidden' name='pass_submit' /> ...underneath your <form> code. ILMV Link to comment https://forums.phpfreaks.com/topic/137371-_post-not-being-recognized-on-submit-of-form-in-ie/#findComment-717737 Share on other sites More sharing options...
rio38 Posted December 17, 2008 Author Share Posted December 17, 2008 I believe the problem exists because when you are on a form (in IE) and you hit enter rather then submit, it doesn't fire the submit button, it just sends the variables to the action script. The fix for this is to add a hidden variable into your form, so no matter what happens (enter, return or submit button), 'pass_submit' is always sent. Add this... <input type='hidden' name='pass_submit' /> ...underneath your <form> code. ILMV Excellent! Worked like a charm. I appreciate the quick response. I guess I will have to modify all of my fomrs now. Thanks. Link to comment https://forums.phpfreaks.com/topic/137371-_post-not-being-recognized-on-submit-of-form-in-ie/#findComment-717741 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.