passing form data via url with GET

passing form data via url with GET

Page 1 of 1

2 Replies - 1914 Views - Last Post: 30 April 2007 - 01:45 AM

#1 rpjd  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 88
  • Joined: 08-March 07

passing form data via url with GET

Posted 29 April 2007 - 05:12 AM

I am trying to pass form data via a url using GET, but I am getting a syntax error in the data variable being passed
this is my form
<form name="updateCustomer" method="GET" action="$_SERVER['PHP_SELF']">
<td align="center"><input type="text" name="customer_name" id="customer_name" size="25" value=""/></td>
<td><input type="hidden" size="10"/></td>
<td align="center"><input type="text" name="customer_address" id="customer_address" size="25" value=""/></td>
<td><input type="hidden" size="10"/></td>
<td align="center"><input type="text" name="customer_contact_no" id="customer_contact_no" size="12" value=""/></td>
<td><input type="hidden" size="10"/></td>
<td align="center"><input type="button" name="addCustomer" value="addCustomer" onclick="add(this);"/></td>
<td><input type="hidden" size="10"/></td>
<td align="center"><input type="button" name="deleteCustomer" value="deleteCustomer" onclick="del(this);"/></td>
</form>



and this is the variable used to append the data to the url which is giving me a syntax error.
var poststr="";
poststr += document.updateCustomer.customer_name.name + "=" + document.updateCustomer.customer_name.value + &document.updateCustomer.customer_address.name + "=" + document.updateCustomer.customer_address.value +  &document.updateCustomer.customer_contact_no.name + "=" + document.updateCustomer.customer_contact_no.value;


can someone point out the error(s)?

rpjd

Is This A Good Question/Topic? 0
  • +

Replies To: passing form data via url with GET

#2 snoj  Icon User is offline

  • Married Life
  • member icon

Reputation: 84
  • View blog
  • Posts: 3,564
  • Joined: 31-March 03

Re: passing form data via url with GET

Posted 29 April 2007 - 03:15 PM

Yeah you have the & outside of quote marks.

Also read the error notices that IE or a firefox debugger give. They provide great information as to where the error is on the line.
Was This Post Helpful? 0
  • +
  • -

#3 rpjd  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 88
  • Joined: 08-March 07

Re: passing form data via url with GET

Posted 30 April 2007 - 01:45 AM

View Posthotsnoj, on 29 Apr, 2007 - 03:15 PM, said:

Yeah you have the & outside of quote marks.

Also read the error notices that IE or a firefox debugger give. They provide great information as to where the error is on the line.

my solution.
]
var x = document.form.x.value;
var y = document.form.y.value;
var poststr = "?" + "x=" + x +"y=" + y;


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1