Pass variable between form and php page?
I might be going about this the wrong way
I have a landing page that开发者_如何学编程 has a form on it. When i post that page the values of the from got to a page called mail.php
I wanted to add a captcha ( in this case re-captcha.com) to the first page to prevent people from spaming my job application site.
I am unsure how to use the php captcha to prevent people from posting but i was thinking that i could use it to set a boolean variable that i send to my mail.php page that will tell it weather or not to acutally send me a job applicants email.
1) how do I pass a variable from one php page to another?
2) is there a better way to use the captcha (im still new to php and web programing so i maybe going the long way around an easy question)
thanks
while i have no experience in captcha,
1) how do I pass a variable from one php page to another?
use the $_SESSION var to pass them.
http://us3.php.net/manual/en/book.session.php
You might look at also using Secureimage PHP Captcha, it also works really well and they have some good sample code.
Also, check out this article on implementing PHP and reCaptcha
The form values will be available in either the $_POST variable or the $_GET variable, depending on how you submitted the form (whether the "mode" attribute of your HTML form tag was set to "post" or "get").
1) You have several methods for passing variables from one page to another but for the most part it relies on the client and session handling. A few of the simplest:
-You can include a hidden form property to pass a variable that you set and it will be posted to the page along with your forms. (input type=hidden)
-You can set the variable in the users session cookies.
-You can use a session id to reference a set variable in your database.
2) There are a lot of ways to use captcha, but if you want to continue with recaptcha take a look at their documents http://recaptcha.net/plugins/php/ http://recaptcha.net/apidocs/captcha/client.html http://wiki.recaptcha.net/index.php/Main_Page
精彩评论