[PHP] PHP, Javascript, and Forms

2006-05-30 Thread Beauford
Hi,

I have a form with about 20 fields in it and have two drop down menus in
which the second one changes depending on the previous one. This is done
with a javascript which reloads the page.

The problem with this is that everything the user has put in so far gets
erased when the page reloads. I am using PHP sessions, but at this point
these fields are not saved yet.

Is there a way to do this using sessions, or some other PHP function. All
the javascript I've looked at reloads the page.

This also screws up my validation routines.

Thanks

B

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



Re: [PHP] PHP, Javascript, and Forms

2006-05-30 Thread Minuk Choi
I think a better way for you to go(it may be a little bit more 
difficult, but it won't have any annoying "flickering" from the 
reloading of page) is to use AJAX.


But if you insist on going on a PHP form + Javascript validation -> 
submit form ->PHP form + Javascript validation, that can be done as well.


It might help to put up a sniplet of your PHP code.  When you say the 
page is reloading, I assume that you mean you have a form tag that sends 
the POST data back to itself?



Beauford wrote:


Hi,

I have a form with about 20 fields in it and have two drop down menus in
which the second one changes depending on the previous one. This is done
with a javascript which reloads the page.

The problem with this is that everything the user has put in so far gets
erased when the page reloads. I am using PHP sessions, but at this point
these fields are not saved yet.

Is there a way to do this using sessions, or some other PHP function. All
the javascript I've looked at reloads the page.

This also screws up my validation routines.

Thanks

B

 



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



Re: [PHP] PHP, Javascript, and Forms

2006-05-30 Thread David Tulloh
Beauford wrote:
> Hi,
> 
> I have a form with about 20 fields in it and have two drop down menus in
> which the second one changes depending on the previous one. This is done
> with a javascript which reloads the page.
> 
> The problem with this is that everything the user has put in so far gets
> erased when the page reloads. I am using PHP sessions, but at this point
> these fields are not saved yet.
> 
> Is there a way to do this using sessions, or some other PHP function. All
> the javascript I've looked at reloads the page.
> 

Javascript can do this easily, you set up your variable content section
in a div.  Then use div.innerHTML = newcontent.  Only the content of the
div will change.

Searching for innerHTML should give you a few tutorials and full examples.


David

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



Re: [PHP] PHP, Javascript, and Forms

2006-05-30 Thread tedd
At 10:03 PM -0400 5/30/06, Beauford wrote:
>Hi,
>
>I have a form with about 20 fields in it and have two drop down menus in
>which the second one changes depending on the previous one. This is done
>with a javascript which reloads the page.
>
>The problem with this is that everything the user has put in so far gets
>erased when the page reloads. I am using PHP sessions, but at this point
>these fields are not saved yet.
>
>Is there a way to do this using sessions, or some other PHP function. All
>the javascript I've looked at reloads the page.
>
>This also screws up my validation routines.
>
>Thanks
>
>B

B:

Use ajax to populate the php session variables.

tedd
-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

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