Jump to content

FORM processing - $_POST doesn't include AJAX component of form


Mav666

Recommended Posts

OK, so I have a form, part of which is generated through AJAX - basically the AJAX part allows you to add extra text boxes - which works until I submit it and cycle through the $_POST (and even the $_GET) and the input from the AJAX part is prominently missing. BUT if I eliminate everything but the form itself on the submitting page, it reads everything, as soon as I add any kind of formatting, the AJAX part goes away. I'm not even sure if this is a PHP issue or what ...

When you're adding the new text boxes, what are you naming them?  Because you'll have trouble trying to display their $_POST data if they all have the same name.

 

Show us some code also and we may be able to help.

The code is generated like this - with $counter being passed by get, that part works

 

for ($i=1; $i <= $counter; $i++) {
echo 'Location '.$i.'<br>';
print 'Address 1  <input name="Location '.$i.' Address 1" id="Location'.$i.'Address1" type="text" size="50"><BR>'."\n";

}

 

then inserted into <DIV> like this:

      document.getElementById('locations').innerHTML = timeValue;

 

when it submits, I collect the data by

 foreach($_POST as $name => $value) {
print "$name : $value<br>";
}

 

The actual script will naturally insert into db rather than print, but this way I see the results right away. The problem is simply that I see the fields and can input data, but they don't show up in the $_POST unless the <FORM> tags are inside the <DIV> or I drop everything but the form (tables, etc)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.