NameSilo

Why the HELL won't this work ??

SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
Watch

will7

VIP Member
Impact
29
I am getting really annoyed with PHP lately. I have wrote the code for a mail form using php and it won't work. Here is the code:

PHP:
<?php
$subj="FusionCre8 Starter Package order";
$to="[email protected]";
$msg="Name: ".$_POST['fname']." ".$_POST['lname']." \r \n Company/Site Name: ".$_POST['compname']." \r \n E-Mail Address: ".$_POST['email2']." \r \n Number of pages: ".$_POST['pno']." \r \n Number of graphics: ".$_POST['gno']." \r \n Hosting: ".$_POST['host']." \r \n Domain Name: ".$_POST['domname']." ".$_POST['domext']." \r \n About the site: ".$_POST['about']." \r \n Further Information: ".$_POST['furtinfo']." \r \n";
$header="From: ".$_POST['fname']." ".$_POST['lname'];
mail($to, $subj, $msg, $header);
header("Location: startthanks.htm");
?>

And, if you need it, here is the HTML for my form (it's quite long):

<form name="form2" method="post" action="startmail.php">
<table width="501" cellspacing="0" cellpadding="0" class="text02" height="423">
<tr>
<td class="text02" height="30" width="134">First Name:</td>
<td class="text02" height="30" width="365">
<input type="text" name="fname"class="form">
</td>
</tr>
<tr>
<td class="text02" height="30" width="134">Last Name:</td>
<td class="text02" height="30" width="365">
<input type="text" name="lname" class="form">
</td>
</tr>
<tr>
<td class="text02" height="30" width="134">Name of Site\Company:</td>
<td class="text02" height="30" width="365">
<input type="text" name="compname" class="form">
</td>
</tr>
<tr>
<td class="text02" height="30" width="134">E-Mail Address:</td>
<td class="text02" height="30" width="365">
<input type="text" name="email2" class="form">
</td>
</tr>
<tr>
<td class="text02" height="30" width="134">Number of pages:</td>
<td class="text02" height="30" width="365">
<select name="pno" class="form">
<option>-- Please Select --</option>
<option>1 page</option>
<option>2 pages</option>
<option>3 pages</option>
<option>Don't know</option>
</select>
</td>
</tr>
<tr>
<td class="text02" height="31" width="134">Number of graphics:</td>
<td class="text02" height="31" width="365">
<select name="gno" class="form">
<option>-- Please Select --</option>
<option>1 graphic</option>
<option>2 graphics</option>
<option>3 graphics</option>
<option>4 graphics</option>
<option>5 graphics</option>
<option>Don't know</option>
</select>
</td>
</tr>
<tr>
<td class="text02" height="30" width="134">Hosting:</td>
<td class="text02" height="30" width="365">
<select name="host" class="form">
<option>-- Please Select --</option>
<option>Yes</option>
<option>No</option>
</select>
</td>
</tr>
<tr>
<td class="text02" height="30" width="134">Required domain
name:</td>
<td class="text02" height="30" width="365">www.
<input type="text" name="domname" class="form">
<select name="domext" class="form" style="width: 60px">
<option>.com</option>
<option>.co.uk</option>
<option>.org</option>
<option>.org.uk</option>
<option>.net</option>
<option>.biz</option>
<option>.info</option>
</select>
</td>
</tr>
<tr>
<td class="text02" height="95" valign="top" width="134">What
is your site about:</td>
<td class="text02" height="95" width="365" valign="top">
<textarea name="about" class="form" style="height: 80px; width: 200px"></textarea>
</td>
</tr>
<tr>
<td class="text02" height="48" valign="top" width="134">Further
information:</td>
<td class="text02" height="48" width="365" valign="top">
<p>
<textarea name="furtinfo" class="form" style="height: 80px; width: 200px"></textarea>
</p>
<p align="left">
<input type="submit" name="Submit" value="Order" class="form" style="width: 50px">
<input type="reset" name="Submit3" value="Reset" class="form" style="width: 60px">
</p>
</td>
</tr>
</table>
</form>

Well, any ideas?
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Originally posted by will7
I have wrote the code for a mail form using php and it won't work

Could you explain more how it doesn't work ? Do you have any error message ? Just not receive mail ? Etc.

It's possible your host turn off the mail function usage.

Thanks,
David.
 
0
Close
It says error on line 5.

The exact error?

Parse error: parse error in /home/www/will7.thefreebizhost.com/startmail.php on line 5

And before you ask, it is a free host but it supports PHP and all functions - apparently...
 
0
Close
Not sure it helps, but maybe could you try to add a newline in the header...

$header="From: ".$_POST['fname']." ".$_POST['lname']." \r \n";
 
0
Close
Works fine for me, will. Not sure what's different about your host's PHP setup. Maybe they have disabled something?

http://www.namepros.com/321/0/
 
0
Close
That code works fine?

Dodgy. I think it might be a problem with my host - it's free, after all...
 
Last edited:
0
Close
welll, once you get your host straightened out, but in a code so you cant email nothing with blank fields
 
0
Close
Weird. It works and I get the mail and everything. I think it could be my host. I'll see what options I have...
 
0
Close
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Filters for activity feeds
Your news feed, Latest activity, and the activity tab on profiles now have filter buttons: All, Posts, Quick replies, and Other. Your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back