Im trying to pass some values into a text box from a child page to the parent page. The code I have works fine passing one integer value through to the parent page, however it won't pass a string. I also want to try and pass another value through to an additional text box, how would I go about doing that?
logRequestAdmin is the name of the form on the parent page, and ClientName is the text box to post the first value to.
Here's my code for the child page:
<head>
<script type="text/javascript">
<!-- Begin
function moveData(info) {
window.opener.document.logRequestAdmin.ClientName.value = info;
self.close();
return false;
}
// End -->
</script>
<table>
<tr>
<td class="clientTop">Client ID</td>
<td class="clientTop">Client Name</td>
<td class="clientTop">Username</td>
<td class="clientTop">Email</td>
</tr>
$query = "Select * from clients";
$result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
while($row = mysql_fetch_array($result))
{
$ClientID = $row['ClientID'];
$ClientName = $row['ClientName'];
$Username = $row['Username'];
$Email = $row['Email'];
echo '<tr>
<td class="clientBottom"><a href="javascript:void();" onclick="moveData(' . $ClientID . ');">' . $ClientID . '</a></td>
<td class="clientBottom"><a href="javascript:void();" onclick="moveData(' . $ClientID . ');">' . $ClientName . '</a></td>
<td class="clientBottom"><a href="javascript:void();" onclick="moveData(' . $ClientID . ');">' . $Username . '</a></td>
<td class="clientBottom"><a href="javascript:void();" onclick="moveData(' . $ClientID . ');">' . $Email . '</a></td>
</tr>';
}
</table>