Jump to content

Recommended Posts

As above,

 

i have been developing a php database site for a few weeks and its nearing completion... so i decided to check other browsers for compatability.

 

i use firefox as my main browser through personal choice and site is flawless, same in chrome and havnt tried safari yet.

 

but in IE some of my PHP forms will submit..

 

what would cause this?

 

here is a form page;

 

<?php
session_start();
include('Includes/auth.php');
require_once('header.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf8"/>
<title>Index</title>
</head>

<body class="cloudy">
<table width="60%" border="0" align="center" cellpadding="2" cellspacing="2">
      <tr>
        <td width="40%" valign="top">
        <div class="content-box column-left">
	<div class="content-box-header">
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="80%"><h3>Add New Test Results</h3></td>
    <td width="20%"><strong>Date: 
        <?php // Prints something like: Monday 8th of August 2005 03:12:46 PM
echo date("F j, Y"); ?>
        <br />
Time: 
<?
//get current timestamp and subtract one <strong class="highlight">hour</strong>
$dat = time() - 3600;
//output time
echo date("g:ia", $dat);
?>
    </strong></td>
  </tr>
</table>

				  </div>
			<div class="content-box-content">
			  <div>
                  <?php
  {
    $result2=mysql_query("SELECT * FROM members WHERE member_id=$_SESSION[sESS_MEMBER_ID]");
    $row2 = mysql_fetch_array($result2);
    $arr = array();
    $arr = explode(';',$row2['settings']);
    $member_id = $row2['member_id'];
    ?>

<?php 
if (isset($_POST['submit'])) {

$insert = "INSERT INTO tests SET 
member_id='$_SESSION[sESS_MEMBER_ID]', 
test1='$test1', 
test2='$test2',
test3='$test3',
test4='$test4',
test5='$test5',
test6='$test6',
test7='$test7',
test8='$test8',
test9='$test9',
test10='$test10',
test11='$test11',
test12='$test12',
test13='$test13',
test14='$test14',
month='$month', 
day='$day', 
date='$date', 
time='$time'"; 

if (@mysql_query($insert)) { 
echo('<div class="msg msg-ok"><p>This item was added successfully</p></div>'); } 
else { 
echo('<div class="msg msg-error"><p><strong>oops!</strong> something went wrong, please try again!</p></div>'); 
}} 

?>
				  <table width="100%" border="0" cellspacing="0" cellpadding="2">
                              <tr>
                                <td>
          <form id="addtest" name="addtest" action="<?=$_SERVER['PHP_SELF']?>" method="post">

                                <input type="hidden" name="date" value="<?php echo date("F j, Y"); ?>" />
                                <input type="hidden" name="month" value="<?php echo date("F"); ?>" />
                                <input type="hidden" name="day" value="<?php echo date("j"); ?>" />
                                <input type="hidden" name="time" value="<?
//get current timestamp and subtract one <strong class="highlight">hour</strong>
$dat = time() - 3600;
//output time
echo date("g:ia", $dat);?>" />  

							<br />
                                <table width="100%" border="0" align="center" cellpadding="4" cellspacing="0">
                                  <tr>
                                    <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
<?php
echo (in_array("test1",$arr) ? "<tr><td><div align='right'><strong><em>Salinity:</em></strong></div></td><td><input type='text' name='test1' value='' /></td></tr>" : '');
echo (in_array("test2",$arr) ? "<tr><td><div align='right'><strong><em>PH:</em></strong></div></td><td><input type='text' name='test2' value='' /></td></tr>" : '');
echo (in_array("test3",$arr) ? "<tr><td><div align='right'><strong><em>Ammonia:</em></strong></div></td><td><input type='text' name='test3' value='' /></td></tr>" : '');
echo (in_array("test4",$arr) ? "<tr><td><div align='right'><strong><em>Nitrite:</em></strong></div></td><td><input type='text' name='test4' value='' /></td>" : '');
echo (in_array("test5",$arr) ? "<tr><td><div align='right'><strong><em>Nitrate:</em></strong></div></td><td><input type='text' name='test5' value='' /></td></tr>" : '');
echo (in_array("test6",$arr) ? "<tr><td><div align='right'><strong><em>Calcium:</em></strong></div></td><td><input type='text' name='test6' value='' /></td></tr>" : '');
echo (in_array("test7",$arr) ? "<tr><td><div align='right'><strong><em>Magnesium:</em></strong></div></td><td><input type='text' name='test7' value='' /></td></tr>" : '');
?>  
                                    
                                    </table></td>
                                    <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="2">
<?php
echo (in_array("test8",$arr) ? "<tr><td><div align='right'><strong><em>Alkalinity:</em></strong></div></td><td><input type='text' name='test8' value='' /></td></tr>" : '');
echo (in_array("test9",$arr) ? "<tr><td><div align='right'><strong><em>Phosphate:</em></strong></div></td><td><input type='text' name='test9' value='' /></td></tr>" : '');
echo (in_array("test10",$arr) ? "<tr><td><div align='right'><strong><em>potassium:</em></strong></div></td><td><input type='text' name='test10' value='' /></td></tr>" : '');
echo (in_array("test11",$arr) ? "<tr><td><div align='right'><strong><em>Iodine:</em></strong></div></td><td><input type='text' name='test11' value='' /></td></tr>" : '');
echo (in_array("test12",$arr) ? "<tr><td><div align='right'><strong><em>Strontium:</em></strong></div></td><td><input type='text' name='test12' value='' /></td></tr>" : '');
echo (in_array("test13",$arr) ? "<tr><td><div align='right'><strong><em>Silica:</em></strong></div></td><td><input type='text' name='test13' value='' /></td></tr>" : '');
echo (in_array("test14",$arr) ? "<tr><td><div align='right'><strong><em>Temperature:</em></strong></div></td><td><input type='text' name='test14' value='' /></td></tr>" : '');
?>
</table>
</td>
                                  </tr>
                                </table>                                   
							 <div align="right"><br />
                      <input type="image" src="img/buttons/submit.png" name="submit" value="Submit" />
                      <input type='image' src='img/buttons/reset.png' name='reset' value='Reset' />
					               </div>
                               </form><?php
}
?>
				</td>
                              </tr>
                            </table>
			  </div> 
			  <!-- End #tab3 -->        

			</div> <!-- End .content-box-content -->
        </td>
      </tr>
</table>
</body>
</html>

 

it seems to be only occuring on forms that update or add details to database, apart from my signup pages. my login pages also work..

Link to comment
https://forums.phpfreaks.com/topic/195964-php-forms-wont-submit-in-ie/
Share on other sites

Your form is using images as submit buttons. See the following link on how to get php to detect or process the resulting x and y coordinates where the image was clicked (works for all browsers) - http://us3.php.net/manual/en/faq.html.php#faq.html.form-image

Your form is using images as submit buttons. See the following link on how to get php to detect or process the resulting x and y coordinates where the image was clicked (works for all browsers) - http://us3.php.net/manual/en/faq.html.php#faq.html.form-image

 

aaaah works when i change it from type="image" to buttons.

 

i read your link but i cant find where to define the X Y values?

You don't define them. The browser takes the name="..." attribute and produces the name.x and name.y values which php then converts to name_x and name_y.

 

Your form method='post' and submit image button has name="submit", so you would detect if the submit button was clicked by checking if either one $_POST['submit_x'] or $_POST['submit_y'] is set.

 

Alternate methods of detecting if your form has been submitted would include using a hidden field or adding a get parameter on the end of the URL in the action="..." attribute.

You don't define them. The browser takes the name="..." attribute and produces the name.x and name.y values which php then converts to name_x and name_y.

 

Your form method='post' and submit image button has name="submit", so you would detect if the submit button was clicked by checking if either one $_POST['submit_x'] or $_POST['submit_y'] is set.

 

Alternate methods of detecting if your form has been submitted would include using a hidden field or adding a get parameter on the end of the URL in the action="..." attribute.

 

can u give any examples of using a hidden field? this sounds easier to achieve.

thank you.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.