Jump to content

Need help with my code


codephp

Recommended Posts

please check screen shot.... for error

<div>
<?php 
require_once("sendcontact.php");
$obj = new insertcontact();
$result = $obj->recordcontact();
?>
<?echo "<center>".$result."</center><br><br>"; ?>
<form action="" method="post">
<table>
<th><center> Please fill the form : </center></th>
<tr>
<td>Name :</td>
<td><input type="text" name="fullname" placeholder="Type your full name"></td>
</tr>
<tr>
<td>email :</td>
<td><input type="email" name="email" placeholder="ex: [email protected]"></td>
</tr>
<tr>
<td>Type of contact :</td>
<td><input type="checkbox" name="checkbox" value="Report" >Report <br>
<input type="checkbox" name="checkbox" value="Feedback" >Feedback <br>
<input type="checkbox" name="checkbox" value="Suggestions" >Suggestions <br>

</td>
</tr>
<tr>
<td>Message:</td>
<td><textarea name="message" style="max-width:500px;" cols="60" rows="10" placeholder="Type message here"></textarea></td>
</tr>
</table>
<input type="submit">
</form>
</div>

contact.php

<?php 
include('dbconnect.php');
class insertcontact{

public function recordcontact(){
// function for inserting videos
$Name = $_POST["fullname"];
$email = $_POST["email"];
$message = $_POST["message"];
$type = $_POST["checkbox"];
$date = new DateTime();
$contactdate = $date-> format('Y-m-d H:i:s');

if(empty($Name) || empty($email) || empty($message) || empty($type)){
return $result = "Missing information....!";
}else{
$strSQL = " INSERT INTO Contact (Name, email, message, contact_type, date ) VALUES ('".$Name."','".$email."','".$message."','".$type."','".$contactdate."')" ;
try{
	mysql_query($strSQL);
	$message = "Thank you for submitting.";
	return $message ;
	clearstatcache();
	exit();
}
catch(CustomException $e){
	throw new Exception( 'Something really gone wrong', 0, $e);
	exit();
}
}
}

}
?>

post-164972-0-87470300-1377430566_thumb.png

Link to comment
https://forums.phpfreaks.com/topic/281539-need-help-with-my-code/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.