Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending data of a form to an IFRAME to execute PHP function ?

Status
Not open for further replies.

Exode

Programmer
Feb 17, 2004
14
CA
Hi again,

as I said, I'm trying to send a usercode variable via a submit button from my from to an IFRAME, so when the frame reload my PHP fonction is executed and print the returned values in the IFRAME. It didn't worked in my previously that's why I'm asking again.

This is my form:
Code:
<form name="formUsrMod" method="GET" action="" target="frmUsrInfo">
<input name="usrCode" maxlength="10" style="width:150;height:23" size="30"/>
<input type="button" value="Add" onClick="process();"> <input type="Button" value="Remove" onclick="removeItem()"/>
<p>
<select name="usrLstCode">
</select>
<input type="button" value="Show information" onClick="document.frames['frmUsrInfo'].location.href='TraitementInfo.php?usrCode='+document.formUsrMod.usrLstCode.value;">
</p>
</form>

This is my IFRAME:
Code:
<iframe src="TraitementInfo.php"
name="frmUsrInfo"
width="100%" height="260"
scrolling="no"
align="left">
</iframe>

And this is the code of my PHP page called by the frame:
Code:
$usrid = $_GET["usrCode"];
if (!$conn = pg_connect($cfgConn)) { bugFromPG($conn); }
   $infoUsr = readUserInfoFromLDAP($usr_id);

<form name="IFRAME">
            		  <fieldset style="width: 752; height: 203; padding: 2">
                  <legend><b>Informations sur l'utilisateur sélectionné</b></legend>&nbsp;
                  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="95%" id="AutoNumber13">
                      	<tr>
                        	<td width="23%">&nbsp;Code:</td>
                        	<td width="177%">&nbsp;<input type="text" name="usrCode" size="20"></td>
                      	</tr>
                      	<tr>
                          <td width="23%">&nbsp;Prénom:</td>
                          <td width="177%">&nbsp;<input type="text" name="usrPrenom" size="20" value="<?echo $infoUsr[1]?>"></td>
                      	</tr>
                      	<tr>
                        	<td width="23%">&nbsp;Nom:</td>
                        	<td width="177%">&nbsp;<input type="text" name="usrNom" size="20" value="<?echo $infoUsr[0]?>"></td>
                      	</tr>
</fieldset></form>


Any help would be highly appreciate since I'm stucked on this one for a while now. Thanks everybody

Frank
 
What happens? You say it doesn't work... but what happens? Does the form get submitted at all? Is it just submitting to the wrong place? What?

Personally I would add an action the form definition on the main page:

Code:
<form name="formUsrMod" method="GET" action="TraitementInfo.php" target="frmUsrInfo">

So that when the form is targetted to your iframe, it knows what php file to process your request with.

Jeff
 
The form isn't submitted because when I test printing the usrcode in the frame, it's always null. Maybe it's not sent at the right place, maybe it isn't sent correctly... My main page's URL doesn't change, but it reload with any changes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top