post non input variables to next php page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mrkimpton
Forum Newbie
Posts: 2
Joined: Thu Jul 24, 2008 11:12 am

post non input variables to next php page

Post by mrkimpton »

I guess this is simple but I've been looking for the answer all day.

I want to take some input from an HTML form, then using javascript validate it and then calculate a key that I need to pass on to my next PHP page.

I can see how I pass input fields using <form action="mypage.php" method="post"> but can't figure out how I can also pass data returned from a javascript function. It is imperative that the end user cannot see this data.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: post non input variables to next php page

Post by califdon »

Easiest way is to include a hidden input field in your form. <INPUT Type='hidden' ID='something' Name='whatever'>
Populate that input field with your Javascript.
mrkimpton
Forum Newbie
Posts: 2
Joined: Thu Jul 24, 2008 11:12 am

Re: post non input variables to next php page

Post by mrkimpton »

It's easy when you know how eh?

Thank you very much.

Mike
Post Reply