Natcon67
05-12-2005, 06:13 PM
hello,
I have read through this (http://www.webdeveloper.com/forum/showthread.php?t=48140) post utilizing NogDog's suggestion but I am getting an error.
The error says "';' missing before statement" and it is pointing to the 4th line of the PHP code below.
here is the code:
print "<script type='text/javascript'>\n";
print "var customer_info = new Array();\n";
foreach ($custArray as $key=>$row) {
print "var customer_info[$key] = new Array();\n";
foreach ($row as $id=>$row2) {
print "customer_info[$key][$id] = $row2;\n";
}
}
?>
function populateCustomer(control) {
var form = document.loadDetail;
var test = form.elements[control+'Company'].value;
form.elements[control+'Address1'].value = 'something else';
}
<?php
print "</script>\n";
when i view the page source, this is what it outputs...
<script type='text/javascript'>
var customer_info = new Array();
var customer_info[2] = new Array();
customer_info[2][address1] = 1234 some address;
customer_info[2][address2] = ;
customer_info[2][city] = AURORA;
customer_info[2][state] = CO;
customer_info[2][zip] = 80012;
customer_info[2][email] = Natcon67@hotmail.com;
customer_info[2][phone] = 1231231233;
var customer_info[1] = new Array();
customer_info[1][address1] = 1234 some address;
customer_info[1][address2] = ;
customer_info[1][city] = FREDERIKSTED;
customer_info[1][state] = VI;
customer_info[1][zip] = 00840;
customer_info[1][email] = nathanc@nhba.com;
customer_info[1][phone] = 1231231234;
function populateCustomer(control) {
var form = document.loadDetail;
var test = form.elements[control+'Company'].value;
form.elements[control+'Address1'].value = 'something else';
}
</script>
Thanks for any help you can give.
Nate
I have read through this (http://www.webdeveloper.com/forum/showthread.php?t=48140) post utilizing NogDog's suggestion but I am getting an error.
The error says "';' missing before statement" and it is pointing to the 4th line of the PHP code below.
here is the code:
print "<script type='text/javascript'>\n";
print "var customer_info = new Array();\n";
foreach ($custArray as $key=>$row) {
print "var customer_info[$key] = new Array();\n";
foreach ($row as $id=>$row2) {
print "customer_info[$key][$id] = $row2;\n";
}
}
?>
function populateCustomer(control) {
var form = document.loadDetail;
var test = form.elements[control+'Company'].value;
form.elements[control+'Address1'].value = 'something else';
}
<?php
print "</script>\n";
when i view the page source, this is what it outputs...
<script type='text/javascript'>
var customer_info = new Array();
var customer_info[2] = new Array();
customer_info[2][address1] = 1234 some address;
customer_info[2][address2] = ;
customer_info[2][city] = AURORA;
customer_info[2][state] = CO;
customer_info[2][zip] = 80012;
customer_info[2][email] = Natcon67@hotmail.com;
customer_info[2][phone] = 1231231233;
var customer_info[1] = new Array();
customer_info[1][address1] = 1234 some address;
customer_info[1][address2] = ;
customer_info[1][city] = FREDERIKSTED;
customer_info[1][state] = VI;
customer_info[1][zip] = 00840;
customer_info[1][email] = nathanc@nhba.com;
customer_info[1][phone] = 1231231234;
function populateCustomer(control) {
var form = document.loadDetail;
var test = form.elements[control+'Company'].value;
form.elements[control+'Address1'].value = 'something else';
}
</script>
Thanks for any help you can give.
Nate