severndigital Posted October 28, 2008 Share Posted October 28, 2008 I have a parent page that opens a pop to list addresses. I want the child window to populate the parent fields with the correct data. My problem is this how do i tell javascript which information to use? My child window is pulling the addresses from mySQL and displaying I don't understand how to pass the information through to Javascript. is there an easier way than this <javascript> function address(id,firstname,lastname,company,address1,address2,city,state,zip,phone,email){ passing info goes here } <php> for($i = 0; $i < count($addressList; $i++){ <a onclick="address(\'' . $id . '\'. $firstname .'\'. $lastname .'\' etc...>Lastname, Firstname</a> } just seems like a whole lot of coding, which generally means there is a better way. thanks, Chris BTW .. i know the code on the screen will not work as is, i am just serving up and example of the coding that i have. Link to comment https://forums.phpfreaks.com/topic/130437-populate-parent-webpage-with-data-from-php-array/ Share on other sites More sharing options...
F1Fan Posted October 28, 2008 Share Posted October 28, 2008 window.parent.document.getElementById('someid').value = whatever... Link to comment https://forums.phpfreaks.com/topic/130437-populate-parent-webpage-with-data-from-php-array/#findComment-676662 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.