Jump to content

page going blank when mixing php with html


blink359

Recommended Posts

Hi im trying to mix php and html in a form however when i do this the whole page disapears and i dont know why

the working form is:

http://valiantflight.comlu.com/emailer/contact.php

<html>
<head>
<title>Contact Us</title>
</head>
<body>
<fieldset>
<legend>Contact Us</legend>
<form action="contact.php" method="post">

<input type="hidden" name="frmsubmit">
Your Email:*<br>



<input type="text" name="email"><br>
Subject:*<br>
<select name="subject">
<option value=""></option>
<option value="1">Recruitment</option>
<option value="2">Absense</option>
<option value="3">Enquiry</option>
</select>



<br>
Message:*<br>
<textarea name="message" cols="50" rows="5"></textarea>



<br>
        <?php           require_once('recaptchalib.php');
           $publickey = "6LeB8LwSAAAAAKwvC3HWJNwWw9vYiSEkvFEvDduD"; // you got this from the signup page
           echo recaptcha_get_html($publickey);
         ?> 




<br>
<input name"Submit" type="submit" value="Send Email">

</form>
Required fields are marked with a *<br><br>
<?php
if(isset($_POST['frmsubmit'])){
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];

//checcking that all relevent information is entered and correct
require_once('recaptchalib.php');
$privatekey = "6LeB8LwSAAAAAA_0IIEnAxL5uOau0TBm83Iog7Ey";
$resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
    

if(!$message || !$email || !$subject)
{
	$errmessage ="<font color='red'>The marked areas in the form have not been filled in correctly.</font>";
}
if (!$resp->is_valid) 
{
	$errmessage ="<font color='red'>The text entered does not match the picture provided.</font>";

}

//Sending the email if nothing is wrong
if(!$errmessage)
{
header("location:send.php?subject=".$subject."&email=".$email."&message=".$message."");
}else{

	echo $errmessage;
}
}
?>
</fieldset>
<br><br><br>
</body>
</html>

and the one that doesnt work is:

http://valiantflight.comlu.com/emailer/test/contact.php

<html>
<head>
<title>Contact Us</title>
</head>
<body>
<fieldset>
<legend>Contact Us</legend>
<form action="contact.php" method="post">
<?php
if(isset($_POST['frmsubmit'])){
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];

//checcking that all relevent information is entered and correct
?>

<input type="hidden" name="frmsubmit">
Your Email:*<br>
<input type="text" name="email">
<?php
if(!$email)
{
	$errmessage ="<font color='red'>The marked areas in the form have not been filled in correctly.</font>";
	echo("<font color='red'><br>Please enter your email.</font>");
}
?>
<br>
Subject:*<br>
<select name="subject">
<option value=""></option>
<option value="1">Recruitment</option>
<option value="2">Absense</option>
<option value="3">Enquiry</option>
</select>
<?php
if(!$subject)
{
	$errmessage ="<font color='red'>The marked areas in the form have not been filled in correctly.</font>";
	echo("<font color='red'><br>Please select a subject.</font>");
}
?>

<br>
Message:*<br>
<textarea name="message" cols="50" rows="5"></textarea>
<?php

if(!$message)
{
	$errmessage ="<font color='red'>The marked areas in the form have not been filled in correctly.</font>";
	echo("<font color='red'><br>Please enter a message to send.</font>");
}

?>


<br>
        <?php 
require_once('recaptchalib.php');
$publickey = "6LeB8LwSAAAAAKwvC3HWJNwWw9vYiSEkvFEvDduD"; // you got this from the signup page
echo recaptcha_get_html($publickey);
require_once('recaptchalib.php');
$privatekey = "6LeB8LwSAAAAAA_0IIEnAxL5uOau0TBm83Iog7Ey";
$resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
         	if (!$resp->is_valid) 
{
	$errmessage ="<font color='red'>Some parts of the form have not been entered correctly and have been marked above</font>";
	echo("<font color='red'>The text you entered does not match the picture provided.</font>");

}
?>


<br>
<input name"Submit" type="submit" value="Send Email">

</form>
Required fields are marked with a *<br><br>
<?php
    

//Sending the email if nothing is wrong
if(!$errmessage)
{
header("location:send.php?subject=".$subject."&email=".$email."&message=".$message."");
}else{

	echo $errmessage;
}
}
?>
</fieldset>
<br><br><br>
</body>
</html>

 

If anyone can help it would be really great

 

Thanks,

 

 

Blink359

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.