We help IT Professionals succeed at work.
Get Started

Submit buttons don't work in ajax generated forms.

Colin Brazier
Last Modified: 2016-02-25
Hi Experts, me again!!!

Not sure if this has ever worked, but I'm rebuilding it for another site so all the moves etc. may have thrown it off.

Basically, my Edit and Delete buttons are not working on a form.  I click them and nothing happens.

This is on my own machine (xampp) so I can't show a working example.  Or a non-working one for that matter.

But here's the html:

while ($row = $db->fetch_Array($sql_query))
		<form method="post" action="postie.php">
				<td><?php echo html($row['title']); ?></td>
				<td> <input type="hidden" name="hdnID" value='" <?php echo $row['id']; ?> "'/>
					 <input type="submit" name="action" value="Edit" class="button small brown" /></td>
				<td> <input type="submit" name="action" value="Delete" class="button small brown" /></td>

Open in new window

This is generated by an Ajax call:

function showEvent(str)
if (str=="")
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  if (xmlhttp.readyState==4 && xmlhttp.status==200)

Open in new window

Interestingly, when I look at the page using developers tools, the rows containing the buttons appear OUTSIDE the forms (see screenshot)...so I've probably done something stupid but I can't see it for looking.

Just seen something...is this structure OK??


Watch Question
Most Valuable Expert 2017
This problem has been solved!
Unlock 3 Answers and 29 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE