Jump to content

Please Help! New to php


asdgq9

Recommended Posts

Hi, I want to post a simple comments box at the bottom of one of my web pages that will send the data from 3 different inputs, named "name," "costumer_mail," and "detail," to my email, but I am new to php. Can someone look at my php code and see what is wrong? I'm having trouble trying to find a spot to put the input "name" in the php.

 

PHP:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

 

<head>

<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />

<title>Send Data Form</title>

</head>

 

<body>

<?php

// Contact subject

$subject='Comment Posted From Website';

// Details

$message=$_POST['detail'];

 

// Mail of sender

 

// From

$headers=$_POST['customer_mail'];

 

// Enter your email address

$to ='******my e-mail address*****';

{

mail($to,$subject,$message,$headers);

}

// Check, if message sent to your email

// display message "Thank you for your submission"

if($send_contact){

echo "Thank you for your submission";

}

else {

echo "ERROR, your comment was not sent";

}

 

 

 

HTML form:

 

<form method="post" action="send_contact.php" name="comment_form">

<table cellspacing="0" style="width: 153%" class="style6">

<tr>

<td style="width: 286px; height: 29px;">Name:</td>

 

<td style="height: 29px">

<input name="name" type="text" style="width: 250px; height: 22px"/> </td>

</tr>

<tr>

<td style="width: 286px">E-mail Address/Phone Number:</td>

<td>

<input name="customer_mail" type="text" class="style4"style="width: 250px; height: 22px"  /> </td>

</tr>

<tr>

<td colspan="2" class="style5">

<textarea name="detail" style="width: 582px; height: 157px"></textarea> </td>

</tr>

<tr>

<td colspan="2" class="style7" valign="top">

<input type="submit" name="Submit" style="width: 87px" value="submit" /> </td>

</tr>

</table>

</form>

 

Link to comment
https://forums.phpfreaks.com/topic/230298-please-help-new-to-php/
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.