PHP Script Problems
- Started
- Last post
- 12 Responses
- Shepstar15
I want to get a formmail script Span safe with captcha. now I have found a tutorial but i keep getting a parse error and can't find the problem. Perhaps some good programmers can help me quickly. Here is the script:
<?php session_start(); if(isset($_SESSION['captcha_spam']) AND $_POST["sicherheitscode"] == $_SESSION['captcha_spam']){ unset($_SESSION['captcha_spam']); Here is the form } ?>
The error is:
Parse error: syntax error, unexpected '<' in ..../index.php on line 361
- Shepstar150
No ideas?
- cosmoo0
"Here is the form" is that in the script? or the form code exists there?
- Shepstar150
yep, I should wrap the php script around the contactform
- Shepstar150
Now I get what you mean, sorry.
Better that way ;)<?php session_start(); if(isset($_SESSION['captcha_spam']) AND $_POST["sicherheitscode"] == $_SESSION['captcha_spam']){ unset($_SESSION['captcha_spam']);
<form id="kontaktform" action="" method="post" name="kontaktform">
....
</form>} ?>
- cosmoo0
cannot have html code just sitting inside php code. try the format below.
<?php session_start(); if(isset($_SESSION['captcha_spam']) AND $_POST["sicherheitscode"] == $_SESSION['captcha_spam']){ unset($_SESSION['captcha_spam']);
?><form id="kontaktform" action="" method="post" name="kontaktform">
....
</form><?php
} ?>- ah vindication7point34
- ha.. was just about to post thatBabySnakes
- Shepstar150
will it then check the part in the form?
<?php session_start(); if(isset($_SESSION['captcha_spam']) AND $_POST["sicherheitscode"] == $_SESSION['captcha_spam']){ unset($_SESSION['captcha_spam']);
<form id="kontaktform" action="" method="post" name="kontaktform">
....
<img src="captcha/captcha.php" border="0" title="Sicherheitscode"> <input type="text" name="sicherheitscode" size="5">
....
</form>
} ?>It should check if the verification code is correct or not.
- did you try the code posted above? give it a shot first.cosmoo
- nope brings two new errors
Shepstar15 - error please.cosmoo
- post them here.cosmoo
- Shepstar150
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /..../index.php:11) in
/..../index.php on line 357
- Shepstar150
Or perhaps someone else knows an easy formmail php script that does also have a captcha verification in it that i could use.
- moth0
session_start() needs to be at the VERY TOP of your page, before any HTML is outputted - that's causing your "headers already sent" error.
you've got some code being rendered before this script...
- wise man moth is.cosmoo
- tried it but still brings an error, don't know whats wrong with thatShepstar15
- drgs0
uran00b
- moth0
what's on line 357 then?
- Shepstar150
it's not the line 357, it always takes the line directly under
...
unset($_SESSION['captcha_spam...