/    Sign up×
Community /Pin to ProfileBookmark

Help with basic else if statement

Trying to ad spam solution to my web form but very new to php and I don’t know the syntax after the else statement. I want it to go to my form processor to complete the form entry. Any help would be very appreciated.

if (!$resp->is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die (“The reCAPTCHA wasn’t entered correctly. Go back and try it again.” .
“(reCAPTCHA said: ” . $resp->error . “)”);
} else {
form id=”form1″ name=”form1″ method=”post” action=”form_processor.php”
}
?>

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@tracknutSep 01.2010 — I think you're just missing the part where you drop out of PHP to push out the html form. Like this:
<i>
</i>&lt;?php
if (!$resp-&gt;is_valid) {
// What happens when the CAPTCHA was entered incorrectly
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp-&gt;error . ")");
} else {
?&gt;

&lt;form id="form1" name="form1" method="post" action="form_processor.php"&gt;
&lt;input&gt; ...etc all your normal html form stuff in here
&lt;/form&gt;

&lt;?php
}
?&gt;
Copy linkTweet thisAlerts:
@cjhurdauthorSep 02.2010 — Thanks for the input but I think I need to give you more information. At the bottom of my form just before the submit button is the reCAPTCHA widget.

My thought was that the form would be filled out and verified by the reCAPTCHA once the submit button was selected, then the form information would be sent over to the from processor code, sending it to email. Do I need to echo the results of the form to the else statement? If so how? Here is the else if statement I currently have:

<?php

require_once('form_processor/recaptchalib.php');

$privatekey = "my private key number is here";

$resp = recaptcha_check_answer ($privatekey,

$_SERVER["REMOTE_ADDR"],

$_
POST["recaptcha_challenge_field"],

$_POST["recaptcha_response_field"]);

if (!$resp->is_valid) {

// What happens when the CAPTCHA was entered incorrectly

die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .

"(reCAPTCHA said: " . $resp->error . ")");

} else {

<form id="form1" name="form1" method="post" action="form_processor/form_processor.php">

<?php

}

?>

This is the error message I get after clicking on the submit button:

Parse error: syntax error, unexpected '<' in /home/content/r/r/w/rrwashington/html/form_processor/verify.php on line 14 //line 14 is <form id="form1" name="form1" method="post" action="form_processor/form_processor.php">
Copy linkTweet thisAlerts:
@cjhurdauthorSep 02.2010 — This is the error message I get after clicking on the submit button:

Parse error: syntax error, unexpected '<' in /home/content/r/r/w/rrwashington/html/form_processor/verify.php on line 14
Copy linkTweet thisAlerts:
@tracknutSep 02.2010 — Sorry, I'm having trouble figuring out your overall flow here, but your error on line 14 is exactly what I would expect, and what my original suggestion should have fixed. Did you try that?

Dave
×

Success!

Help @cjhurd spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...