No, where you want to show the error (contact2.php). See line 27 of your previous code post.

Cheers. I'm nearly there. As my html is all in php strings, I've had to edit the code you've just given me. Is this nearly right?

' . ((isset($_GET['error']) and ($_GET['error']=='recaptcha')) 
 { echo 'There was an error in your recaptcha'; } . '

It's showing up a syntax error on the second line.

' . ((isset($_GET['error']) and ($_GET['error']=='recaptcha')) ?
 'There was an error in your recaptcha' : '' . '

Cheers. Adding that code to the table just above the recaptcha sparks a syntax error on the last line of the following code:

<td colspan="2" align = "center">' . ((isset($_GET['error']) and ($_GET['error']=='recaptcha')) ?
 'There was an error in your recaptcha' : '' . '
<td colspan="2" align="center"> 
'. $captcha .'
<center><table width = "100%" style = "border: 0px; width: 395px"><tr><td align = "right">
<ul id="sbtbtn">
<li><a style = "margin-top: 5px; text-align: left; font: 8pt arial;" href="Javascript:verifyEnEnquiry(document.enquiries);" title="'.$sb->dt('Send Enquiry').'" class="darkblue">'.$sb->dt('Submit Enquiry').'</a></li>
<p style="text-align:right !important">
<!--<input name="submit"  style="border:none" type="image" src="./img/en/btn-sendenquiry.gif" title="'.$sb->dt("Send Enquiry").'">-->
<p><em>'.$sb->dt('*Mandatory fields').'<br />

Any idea why?

Try this. Next time, also paste your error message.

<td colspan="2" align = "center">' . (((isset($_GET['error']) and ($_GET['error']=='recaptcha')) ?
 'There was an error in your recaptcha' : '') . '

Still get the error:

Parse error: syntax error, unexpected ';' in /home/company/public_html/contact5.php on line 276

Sorted it. It was a stray "(".

Thanks very very much for your help.

Out of curiosity, and this is the last thing from me, is there a way to add a red border to something instead of displaying the error message? So when they return to the page, the captcha has a red border around it?

And / or a way to display an entire table rather than just a message, when an error occurs?

Well, if your captcha is contained within a div, instead of echo'ing text, you can echo an inline style for that div, enabling the red border. You control what you display.

Cheers. Much appreciated. I think I'm done now! :)

Good. You may want to mark this thread solved. If there is anything else, just start a new one.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.