Log in

View Full Version : PHP Form on .html site



euphoriastudio
10-10-2008, 03:12 AM
So I'm having an issue and was curious if I need to rewrite the rest of my site in php, get a different host, or change my coding. My site is written in HTML as is the form, but the way the form is processed is through a PHP page. Any ideas as to why the code will not send the form to my email?

I use freehostia.com currently so I'm not sure if that may be the problem.
This is the link to my site if it will help http://euphoriastudio.freehostia.com

html page the form appears on:


<html>
<head>
<title>Quote</title>
</head>
<body>
<form method="post" action="sendmail.php">
Name:<br><input type="text" size="50" maxlength="120" name="name"><p>
Phone:<br><input type="text" size="50" maxlength="120" name="phone"><p>
Email:<br><input type="text" size="50" maxlength="120" name="email"><p>

What you need:<br>
<input type="checkbox" name="need" value="Website">Website
<br>
<input type="checkbox" name="need" value="Redesign">Re-Design
<br>
<input type="checkbox" name="need" value="Template">Template Modification
<br>
<input type="checkbox" name="need" value="Graphics">Graphic Design
<br>
<input type="checkbox" name="need" value="LogoBrand">Logo/Brand Creation
<br>
<input type="checkbox" name="need" value="Ad">Advertising Ad
<br>
<input type="checkbox" name="need" value="Banner">Banner Ad<p>

Project Description:<br><textarea rows="5" cols="40" name="descrip">
Try to be as descriptive as possible. Include deadlines, features, and a budget range. Also include times you are available to receive calls.
</textarea><p>

<input type="submit" value="submit" name="submit"><br />
</form><br />
</body>
</html>



this is the page the form is processed through:

<?php
$required = array('phone', 'email', 'name');
foreach($required as $v){
if(empty($_POST[$v])){
echo 'sorry, '.htmlspecialchars($v).' needs to be filled in';
die();
}
}
$name = $_REQUEST["name"];
$phone = $_REQUEST["phone"];
$email = $_REQUEST["email"];
$need = $_REQUEST["need"];
$descrip = $_REQUEST["descrip"];
$embody = "Name: $name\n Phone: $phone\n Email: $email\n Project: $need\n Description: $descrip\n";

mail("euphoria.studio@gmail.com", "New Client Request", $embody, "From: $name <$email>" )
or die("Can't send email");
header( "Location: http://euphoriastudio.freehostia.com/index.html" );
?>

Any help is greatly appreciated. I'm a total novice when it comes to PHP so bear with me if I'm having trouble.

motormichael12
10-11-2008, 02:37 AM
Does it give the "Can't send email" error that you ahve in the sendmail.php code, or does it act as if it sent but then doesn't ever get to the inbox?

euphoriastudio
10-11-2008, 04:20 AM
It acts as if it sent it. It returns me to the /main.html page like I set it to. But nothing shows up in my email.

euphoriastudio
10-14-2008, 06:51 PM
Any ideas at all? :(

boogyman
10-14-2008, 07:39 PM
If it acts like it is sending, first try to see if its related to the variables. So 'create' a default body, meaning don't use the values the user selects, but rather use your own values explicitly.



mail("euphoria.studio@gmail.com", "New Client Request", "Testing Email", "From: someone <someoneelse@gmail.com>" )
or die("Can't send email");

euphoriastudio
10-16-2008, 06:09 PM
Thanks so much everyone for your greats suggestions, I did some digging and after many requests for help from my host found out its their fault. Script must be fine but the host doesnt allow the mail() tag in php. Again I'm very grateful for all the help here!