Hi

I have a form that amends current values in a MySQL database.

This works fine in FireFox, but does nothing in IE when you click on the Save button.

<input type="button" value="SAVE" onclick="submit();" />

Is what I am using

What am I doing wrong?

Thanks

try changing:

<input type="button" value="SAVE" onclick="submit();" />

to:

<input type="submit" value="SAVE"  />

Hi

That gave the same result. It might be easier if I post the start of the form code for you to see:

<form name="EditHome" method="post" enctype="multipart/form-data" action="SaveHome.php">
<input type="hidden" name="id" value="<?= $id ?>">

<table align="center" width="100%" border="0" bgcolor="f59422" cellspacing="0" cellpadding="0">


<tr>
<td valign="top" height="50">
    <table width="100%">
    <tr>
<td valign="top" height="50">
    <table width="100%" bgcolor="f8ab60">
    <tr>
    <td valign="top">
	    <table width="100%">
	    <tr>
		<td valign="top">
		<FORM>
<INPUT TYPE="button" VALUE="Return to Property Admin" onClick="parent.location='property_admin.php'">
</FORM>
</td>
<td valign="top">
		<FORM>
<INPUT TYPE="button" VALUE="Add a Picture" onClick="parent.location='AddPicture.php?home_id=<?= $id ?>'">
</FORM> 
</td>
<td valign="top">		
		<input type="button" value="SAVE" onclick="submit();" />
		
		</td>
		</tr>
		</table>
    </td>
    </tr>
    </table>
</td>
</tr>
</tr>

    </table>
</td>

You are not allowed to nest HTML forms. To clarify, this is NOT allowed:

<form action="test1.php">
  ...
  <form action="test2.php">
    ...<input type="submit" value="Inner Submit" />
  </form>
  ...<input type="submit" value="Outer Submit" />
</form>

You have to get rid of the inner form(s). You can nest the entire table within a "master" form:

<form name="EditHome" method="post" enctype="multipart/form-data" action="SaveHome.php">
<input type="hidden" name="id" value="<?= $id ?>">

<table align="center" width="100%" border="0" bgcolor="f59422" cellspacing="0" cellpadding="0">


<tr>
<td valign="top" height="50">
    <table width="100%">
    <tr>
<td valign="top" height="50">
    <table width="100%" bgcolor="f8ab60">
    <tr>
    <td valign="top">
	    <table width="100%">
	    <tr>
		<td valign="top">
		<!-- <FORM> -->
<INPUT TYPE="button" VALUE="Return to Property Admin" onClick="parent.location='property_admin.php'">
<!-- </FORM> -->
</td>
<td valign="top">
		<!-- <FORM> -->
<INPUT TYPE="button" VALUE="Add a Picture" onClick="parent.location='AddPicture.php?home_id=<?= $id ?>'">
<!-- </FORM>  -->
</td>
<td valign="top">		
		<input type="submit" value="SAVE"  />
		
		</td>
		</tr>
		</table>
    </td>
    </tr>
    </table>
</td>
</tr>
</tr>

    </table>
</form>
commented: Well Explained, Thanks +1

That is perfect, Thanks

Why does it work on FireFox the original way I had it?

There is no specification that formally states how to behave when forms are nested. Thus, different browser developers handle it differently. Some of them ignore the nested elements. Others use the inner-most form. The only way to achieve consistency is to get rid of the nested forms.

Thank you for the clear explanation and for sorting my code out. :D

That is perfect, Thanks

Why does it work on FireFox the original way I had it?

have you tried validating your previous html?
do it -and you may find your answer there.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.