Jump to content

<form method="post"> has no data


Recommended Posts

I have never seen this before so I'm stumped as to what the problem is:

 

General Problem:  I am submitting a form to an iframe, something I've done a number of times in other code without problems, but I'm having no luck this time and I'm not sure what is wrong. The code below shows is two forms.  One called "SelectIslandForm" and one called "MapControlForm2".  "SelectIslandForm" works as it should, althouigh it does not have to submit any data as everything is done via javascript.  It has a combobox that has an ajax call associated with it that places a form into <td ID="MapControls"> via the InnerHTML method. What should happen is when I click the submit button on form "MapControlForm2", the form should POST the information to the "_iframe_getisland.php" (reloading iFrame "layouttableiframecontent" in the process); however, the form POST contains no data. The POST does not even know that ID="formsubmit" is equal to 1.  It literally knows nothing as if it didn't send any information.  This is how it is in both Firefox and Google Chrome.  In Internet Explorer, the form POST knows the answer to any input in that was added in the AJAX dynamic inputs but does not know that ID="formsubmit" is equal to 1.

 

What could possibly be causing the form to not POST all information or only posting the new fields called from the AJAX page in IE?  I'm dumb founded.

 

This is the relevent section of the main page.

<td width="290" align="left" valign="top" colspan="2" ID="IslandControls" NAME="IslandControls" bgcolor="#030201">
<form NAME="SelectIslandForm" ID="SelectIslandForm">
		<input type="hidden" NAME="IslandID" 	ID="IslandID"	size="3"	value="1">
		<input type="hidden" NAME="MainMenuID" 	ID="MainMenuID"	size="3"	value="1">
		<input type="hidden" NAME="SubMenuID" 	ID="SubMenuID"	size="3"	value="1">
<TABLE width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td colspan="3"> </td>
		</tr>
	<tr>
		<td colspan="3" background="images/topicsbg.gif">
			<font color="#000000" FACE="monospace" size="2">Islands</font>
			</td>
		</tr>
	<tr>
		<td colspan="3" bgcolor="#092123" align="left" valign="top">				
			<?php
			// Display Islands List
			ui_islands_list("all", "no", "ISLANDNAME", "combobox", "");
			?>	
		</form>
	<form ID="MapControlForm2" NAME="MapControlForm2" method="post" action="_iframe_getisland.php" target="layouttableiframecontent">
		<input type="text" ID="islandid_js">
		<input type="text" ID="formsubmit" value="1">
		<input class="formsubmit" type="button" name="button" value="submit" onclick="javascript:document.MapControlForm2.submit()">
			</td>
		</tr>
	<tr>
		<td ID="MapControls" NAME="MapControls">
			Map Layer Controls
			</td>
		</form>
		</tr>
	</table>
</td>

 

Here is the content of the AJAX page:

 

include("includes/header.inc");	

$field_id = $_GET["islandid"];
//echo "Field ID: ".$field_id;

?>	
<div NAME="IslandMapLayers" ID="IslandMapLayers" border="1" style="position:absolute; left:724px; top:140px; width:290px; height:500px; z-index: 1;overflow:auto;">
	<TABLE width="100%" border="1" cellpadding="0" cellspacing="0">
		<tr>
			<td colspan="2" background="images/topicsbg.gif">
				<font color="#000000" FACE="monospace" size="2"> Island Layers </font>
				</td>
			</tr>
		<tr>
			<td>
				<?php
					// Display Islands List
					ui_layors_list($field_id, "no", "ISLANDLAYORS", "checkbox", "");
					?>
				</td>
			</tr>
		<tr>
			<td colspan="2" background="images/topicsbg.gif">
				<font color="#000000" FACE="monospace" size="2"> Island MapPoints </font>
				</td>
			</tr>
		<tr>
			<td>
				<?php
				// Display Islands List
				ui_mappoints_cp1($field_id);
				//ui_mappoints_list($field_id, "no", "ISLANDLAYORS", "checkbox", "");
				?>
				</td>
			</tr>
		</table>			
	</div>

Link to comment
https://forums.phpfreaks.com/topic/241220-has-no-data/
Share on other sites

<input type="text" ID="islandid_js">
<input type="text" ID="formsubmit" value="1">

 

It is the name attributes that are used when posting forms. The id attribute is NOT used. You need to add name attributes to the fields that you want to access in PHP.

Link to comment
https://forums.phpfreaks.com/topic/241220-has-no-data/#findComment-1239176
Share on other sites

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.