Help passing checkbox values from window
| From: | Yvonne Rojas | Date: | Thu, 26 Oct 2000 13:55:25 +0000 |
| Subject: | Help passing checkbox values from window | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-22133@lists.php.net to get a copy of this message | ||
You all have been a great help to me in the
past, and now I come again
searching for answers :)
In my one.php I use javascript to open up
two.php when the user clicks
on a Select button. In two.php he is presented
with a number of items,
presented in checkboxes, that he can select.
Once he selects his items,
a javascript function is called to close the
window so that he's back
at one.php. I want him to be able to view his
selected items on
one.php. How can I do this?
Currently I have the following code which I know
is wrong:
<HEAD>
<script language="javascript">
function SendToOne(ItemList){
window.opener.document.one.ItemList.value=ItemList;
}
</HEAD>
<?php
//this is two.php
//make connection to database
//select items from database table
$i=0;
printf("<td>Line Items:</td>");
while($row=fetch_array)$sql_result)){
$item=$row["Item"];
printf("<input type=checkbox name=itemlist[$i]
value=$item>$item");
$i++;
}
$array=${itemlist};
printf("<input type=submit name=sendtoone
onClick=javascript:SendToOne($array);>");
?>
The following is how I am receiving itemlist in
one.php which I know is
definitely not the right way to do it...
//this is one.php
<?php
printf("<input type=text name=ItemList>");
?>
Help!
Yvonne