use something like: customer_info["customer_info[shipto_address_line1]"].value = customer_info["customer_info[billto_address_line1]"].value; ie. each form element can be referenced by name within the elements array: frm.name --> frm["name"]
-----Original Message----- From: Steve Maroney [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 22, 2001 12:48 PM To: [EMAIL PROTECTED] Subject: [PHP] PHP Arrays conflicting with Javascript, PLease advise?!? Hey guys, Im have a couple of form elements with the names of php arrays. Instead of just using <input type=text name=myArray[]>, Im defining the array keys. Before the form is submitted to the PHP script, Im using javascript to modify the element values. The array brackets that are part of the element name are conflicting with JavaScript. I can't figure out how to get JavaScript to take form elemenets literly. Below is some of my code for further detail: // THIS CODE WAS FORMATTED TO FIT YOUR TV SCREEN :) <script> <!-- Hide code from Old browsers function billing_is_shipping() { if (document.customer_info.shipto_billto.value == "true") { customer_info.customer_info[shipto_address_line1].value = customer_info.customer_info[billto_address_line1].value; customer_info.customer_info[shipto_address_line2].value = customer_info.customer_info[billto_address_line2].value; customer_info.customer_info[shipto_city].value = customer_info.customer_info[billto_city].value; customer_info.customer_info[shipto_state].value = customer_info.customer_info[billto_state].value; customer_info.customer_info[shipto_zipcode].value = customer_info.customer_info[billto_zipcode].value; }; }; // Done --> </script> <form name="customer_info" action="index.php" method="post" onSubmit="javascript:billing_is_shipping();"> <input type="hidden" name="check_out_stage" value="1"> <input type="hidden" name="action" value="Check Out"> <center> <table border="1" width="450" cellpadding="0" cellspacing="0" bgcolor="#FFFFD2"><tr><td wdith="450" align='center'><font size="4"><b>Billing Information</b> </font> </t$ <br> <table border="1" width="450" cellpadding="0" cellspacing="0" bgcolor="#FFFFD2"> <tr> <td> <table border="0" cellpadding="2" cellspacing="0" width="450"> <tr><td align='right' width="130"><b>Name:</b></td> <td width="320"><input type="text" name="customer_info[billto_name]" size="40"></td></tr> <tr><td align='right' width="130"><b>Address:</b></td> <td width="320"><input type="text" name="customer_info[billto_address_line1]" size="40"></td></tr> <tr><td>   </td> <td width="320"><input type="text" name="customer_info[billto_address_line2]" size="40"></td></tr> <tr><td align='right' width="130"><b>City:</b></td> <td width="320"><input type="text" name="customer_info[billto_city]" size="40"></td> </tr> <tr><td align='right' width="130"><b>State:</b></td> <td width="320"><select name="customer_info[billto_state]"> <-- OTHER CODE SNIPPED --> Thank you, Steve Maroney -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]