Jump to content

Using link in child window to write to textbox in parent window


JLitkie

Recommended Posts

Hey guys I am having a struggle with some coding.  I have a page where you can open a popup window with a bunch of links on it.  I want to be able to click a link and have the information obtained on the link write to a textbox on the parent window.  The window needs to stay open so they can click on several links and add a bunch of information to the text box.  My current coding for the child window is:

 

while($row = mysql_fetch_array($result))
{

echo"<tr><td><a href='#' class=''" ?> onclick="opener.document.forms["catering"].elements["details"].value = '<?php echo"$row[1]"; ?> '"> <?php echo"$row[1]</a> <font class='subhead'><b>$$row[4]</b></font><br></font>
<font class='menutext'>$row[2]</font>
</tr></td>";

}

 

The coding for the parent window regarding the form is:

 

<form method="POST" action="proc2.php" name="catering">
<table cellpadding=5 border=0 width=80% align=left>
<tr>
<td><b>Name</b></td>
<td><input type=text name="name" size=50 class="form"></td>
</tr>
<tr>
<td><b>Phone</b></td>
<td><input type=text name="phone" size=25 class="form"></td>
</tr>
<tr>
<td><b>Email</b></td>
<td><input type=text name="email" size=50 class="form"></td>
</tr>
<tr>
<td colspan=2 valign=top><b>Catering Request Description <a href="menusub.php" onclick="NewWindow(this.href,'name','500','500','yes');return false" class="menusub">(MENU)</a></b></td>
</tr>
<tr>
<tr>
<td></td>
<td>
<input type=hidden name="subject" value="Catering Service" size=50 class="form">
<textarea name="details" id="details" cols="50" Rows="12" style="font-size:15px; border:solid; font-family:Bradley Hand ITC, Book Antiqua, Arial; border:solid 1px; background-color:transparent;"></textarea></td>
</tr>
<tr>
<td></td>
<td><input type=submit class="submit" value="Send Message" style=""></td>
</tr>
</table>
</form>

 

I appreciate any help I can get!!

Link to comment
Share on other sites

  • 4 weeks later...

You've not really explained what's not working. Do you receive an error? What does the HTML look like after it's been processed? I.e. what's the source of the child window? If there's a line-break or single/double-quote in $row[1] then it'll be generating a JavaScript error, in which case would explain why it's not working.

Link to comment
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.