SCRIPT ERROR


Posted on 16th Feb 2014 07:03 pm by admin

Here is the CONTACT FORM I made for our website:

<form id="form1" name="form1" method="post" action="">
<table width="528" border="0">
<tr>
<td><div align="right">
<label></label>
<label for="textfield">Email:</label>
</div></td>
<td>
<div align="left">
<input name="email" type="text" id="email" size="30" maxlength="90" />
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="textfield">Name:</label>
</div></td>
<td><div align="left">
<input name="name" type="text" id="name" size="30" />
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="textfield">Phone Number:</label>
</div></td>
<td><div align="left">
<input name="phonenumber" type="text" id="phonenumber" size="30" maxlength="12" />
</div></td>
</tr>
<tr>
<td><div align="right">Website Rating: </div></td>
<td><div align="left">
<p>
<label>
<input type="radio" name="Rating" value="rating1" />
1</label>
<label>
<input type="radio" name="Rating" value="rating2" />
2</label>
<label>
<input type="radio" name="Rating" value="rating3" />
3</label>
<label>
<input type="radio" name="Rating" value="rating4" />
4</label>
<label>
<input type="radio" name="Rating" value="rating5" />
5</label>
</p>
<p>
<label>
<input type="radio" name="Rating" value="rating6" />
6</label>
<label>
<input type="radio" name="Rating" value="rating7" />
7</label>
<label>
<input type="radio" name="Rating" value="rating8" />
8</label>
<label>
<input type="radio" name="Rating" value="rating9" />
9</label>
<label>
<input type="radio" name="Rating" value="rating10" />
10</label>
<br />
</p>
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="select">Topic:</label>
</div></td>
<td><div align="left">
<select name="commenttopic" id="commenttopic">
<option selected="selected">Choose a topic</option>
<option value="Missing College Info">Missing College Info</option>
<option value="Missing College Name">Missing College Name</option>
<option value="General Query">General Query</option>
<option value="Site Upgradation Suggestion">Site Upgradation Suggestion</option>
<option value="Admistrator Appointment">Administrator Appointment</option>
<option value="Advertisement">Advertisement</option>
</select>
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="textarea">Comment:</label>
</div></td>
<td><div align="left">
<textarea name="comment" cols="30" rows="5" id="comment"></textarea>
</div></td>
</tr>
<tr>
<td><div align="right">
<label for="Submit"></label>
</div></td>
<td><div align="left">
<label for="label"></label>
<input type="reset" name="Reset" value="Reset the form" id="Submit" />
<input type="submit" name="Submit" value="Submit" id="label" />
</div></td>
</tr>
</table>
</form>

I am very new to php. So please help me with the php script of the contact form. I am having difficulty in running the script. Here is my script:

<?php
$to = $_REQUEST['sendto'] ;
$from = $_REQUEST['Email'] ;
$name = $_REQUEST['Name'] ;
$headers = "From: $from";
$subject = "Web Contact Data";

$fields = array();
$fields{"email"} = "email";
$fields{"name"} = "name";
$fields{"phonenumber"} = "phonenumber";
$fields{"list"} = "Mailing List";
$fields{"commenttopic"} = "commenttopic";
$fields{"comment"} = "comment";

$body = "We have received the following information:nn"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %sn",$b,$_REQUEST[$a]); }

$headers2 = "From: noreply@YourCompany.com";
$subject2 = "Thank you for contacting us";
$autoreply = "Thank you for contacting us. Somebody will get back to you as soon as possible, usualy within 48 hours. If you have any more questions, please consult our website at www.oursite.com";

if($from == '') {print "You have not entered an email, please go back and try again";}
else {
if($name == '') {print "You have not entered a name, please go back and try again";}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
if($send)
{header( "Location: http://www.YourDomain.com/thankyou.html" );}
else
{print "We encountered an error sending your mail, please notify webmaster@YourCompany.com"; }
}
}
?>

No comments posted yet

Your Answer:

Login to answer
193 Like 44 Dislike
Previous forums Next forums
Other forums

Async WSAConnect failed on XP with error code = 2 ("File not found")
Hi all,

I have very strange bug, please help me if you can.

It is reproduced o

removing space from the end of a variable
i have a variable $image which contains the following url "http://tiles.xbox.com/tiles/oo/P5/0m

Business Health Check
Hello

I need to create an online business health check for a client it will be multiple choi

Handling text changed in text box control using Ajax
I need to create a web form with a text box control. When someone types text into the textbox I nee

can i optmize image to 50% quality before uploading 2 server
Hi there

i have jus written a php program to upload and display images but when i try to uplo

Structure Question - One Table or One Table Per Record Set?
I have a web app (mySQL and PHP) which allows people to create an item with up to 200 records which

PHP webpage & array print issue
I have this code running, and it works perfectly … however, see my bottom bit about what I see

Access website from only 1 computer...?
One of my customers wants his website to only be accessed by people in which they bought the website

matching numbers inside ( )
I know I can match numbers by just [0-9]+, so I thought matching numbers inside ( ) would be somethi

comparing tables across databases sql refinement ideas required
Hi all

Via pl/sql I need to ensure that data between tables in different databases match

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash