[PHP] Accessing a form variable before the form is posted

2002-06-21 Thread Ma Siva Kumar

My function for generating a select menu for a city sets the select name to 
form[city_id]. 

In one of the forms, there is a selection for City in the address details as 
well as one for the port of destination. If I use the function both the the 
select name will be form[city_id]. The port of destination selection 
overwrites the form[city_id] from the selection of City.

Is there a way to access the first form[city_id] for assigning to another 
variable?

In short is it possible to access a variable from the form before the form is 
posted?

Best regards,


Siva,


-- 
Ma Siva Kumar
BSG LeatherLink,
Tamil Nadu, India - 600040

Email: [EMAIL PROTECTED]
Website: http://www.leatherlink.net/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Accessing a form variable before the form is posted

2002-06-21 Thread Duncan Hill

On Fri, 21 Jun 2002, Ma Siva Kumar wrote:

 In one of the forms, there is a selection for City in the address details
 as well as one for the port of destination. If I use the function both the
 the select name will be form[city_id]. The port of destination selection
 overwrites the form[city_id] from the selection of City.

Use different variable names.  Or make your function return a value, and use 
assignment to handle it.

 In short is it possible to access a variable from the form before the form
 is posted?

In short, no.

The flow is like this:

Browser requests page.
Webserver serves page, after parsing (if needed).
Browser displays page to user, and essentially disconnects from webserver.
User fills in form.  Server has no clue as of yet.
User presses submit.  Browser connects to server and sends data.  Server now 
knows about the data.

-- 

Sapere aude
My mind not only wanders, it sometimes leaves completely.
Never attribute to malice that which can be adequately explained by stupidity.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Accessing a form variable before the form is posted

2002-06-21 Thread Ma Siva Kumar

Thanks for the help

Duncan Hill wrote:

 Use different variable names.  Or make your function return a value, and
 use assignment to handle it.

Finally I made the function to take the select name as an optional variable 
and used different names for the two. This helped me in other situations 
also. Thanks a lot.

johannes reichardt wrote:

 If not you´d have big trouble ;)

Huge !!! I would have to add 7 more lines in my file :-). 


 form action=aösldkfj method=post onsubmit=return checkmystuf();

 // this goes in the header

 script
 function checkmystuff() {
 document.forms.city_id.value.toUppercase(); //just a stupid example
 return true;
 }


I am just beginning to test the waters of web application development and not 
using JavaScript much so far. Thanks any way.


Best regards,

Siva





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php