views:

82

answers:

2

I have an html form which uses a php file to submit data by email. I want to add some code (which I already have) to generate random numbers for spam protection. Can I call another php file within my form?

Here is the code that goes in the form:

<form name="mail" action="go.php" method="post" onsubmit="return CheckData()">
<input type="text" name="q">
<input type="submit" name="Submit" value="OK">
</form>

I am a real novice with php so any help would be appreciated.

LozFromOz

+3  A: 

you can do it with image in your form that call to php file.

the famous is to use captcha,

read this link :

http://stackoverflow.com/questions/450835/how-do-you-stop-scripters-from-slamming-your-website-hundreds-of-times-a-second

a good captcha to insert in php :

http://recaptcha.net/plugins/php/

Haim Evgi
+1 for the recaptcha no sense in rewriting what already works and works well
Unkwntech
+1  A: 

There's no need to have the browser make two http requests for two different urls to the webserver. Your php script go.php can do what ever you want it to do, e.g. include two other scripts and/or calling two functions or ...

<?php // go.php
require_once 'spam_protection.php';
require_once 'form_helper.php';
require_once 'database_something.php';

....
VolkerK