Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » NEED help to configure PHP scrit...plz
Closed Thread
Old 07-13-2005, 07:36 AM   #1 (permalink)
 
Super Techie

Join Date: Mar 2005

Posts: 457

Rawan AbuSalman

Default NEED help to configure PHP scrit...plz

Hi,

I have been trying to create a form which directly sends an email to me. I have found the php script needed but I have to edit the preset form.

THE THING IS THAT I HAVE NO CLUE HOW TO EDIT OR WRITE PHP SCRIPTS!!!

I tried editing the existing fileds and it worked (in the form and the script, there was a name and email text box only...I managed to add a phone and address and city text boxes and I added the php scripts to the existing one.

But I also have radio buttons in the form and I have been trying for 3 days to find the script for them but I couldnt.

Can anyone please help me!!!!
any help is much appreciated.




I also need to configure the message that is automatically sent to my email address to display ALL of the information I have in the form I created (name, eamil, address, city, phone, mobile, order...) not only the ones they have.

I have tried to add $city, $phone .... but I was not able to create spaces between them (like
in html) so all the info I received in my email where stuck next to each other!!


I have provided you with the html code of my form, the html code of the form I found (that has the php script) and the PHP script.








This is the html code of the form I created.


Code:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Order</title>
</head>

<body>

<p align="center">
<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="obj1" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" border="0" width="349" height="94">
	<param name="movie" value="Order.swf">
	<param name="quality" value="High">
	<embed src="Order.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="obj1" width="349" height="94" quality="High"></object>
</p>
<p align="left">
<font size="2" face="Verdana">Personal Info</font><font face="Verdana" size="1"> </font></td>
	<td style="border-style: dotted; border-width: 1px; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px">
	</td></tr>
</table></p>
<table border="0" cellpadding="8" cellspacing="8" summary="feedback form" id="table12">
<tr><td style="border-style: dotted; border-width: 1px"><font face="Verdana" size="1">
	Name: </font></td>
	<td style="border-style: dotted; border-width: 1px">
	<font size="1" face="Verdana"><input type="text" name="name" size="25" /></font></td></tr>
</table>
<table border="0" cellpadding="8" cellspacing="8" summary="feedback form" id="table13">
<tr><td style="border-style: dotted; border-width: 1px">
	<p align="left">
	<font face="Verdana" size="1">Email address: </font></td>
	<td style="border-style: dotted; border-width: 1px">
	<font size="1" face="Verdana"><input type="text" name="email" size="25" /></font></td></tr>
</table>
<table border="0" cellpadding="8" cellspacing="8" summary="feedback form" id="table14">
<tr><td style="border-style: dotted; border-width: 1px">
	<font face="Verdana" size="1">
	Phone 
	</font></td><td style="border-style: dotted; border-width: 1px"><font size="1" face="Verdana">
	<input type="text" name="phone" size="25" /></font></td></tr>
</table>
<table border="0" cellpadding="8" cellspacing="8" summary="feedback form" id="table15">
<tr><td style="border-style: dotted; border-width: 1px"><font face="Verdana" size="1">
	Mobile 
	</font></td><td style="border-style: dotted; border-width: 1px"><font size="1" face="Verdana">
	<input type="text" name="mobile" size="25" /></font></td></tr>
</table>
<table border="0" cellpadding="8" cellspacing="8" summary="feedback form" id="table16">
<tr><td style="border-style: dotted; border-width: 1px">
	<font face="Verdana" size="1">City  
	</font></td><td style="border-style: dotted; border-width: 1px"><font size="1" face="Verdana">
	<input type="text" name="city" size="25" /></font></td></tr>
</table>
<table border="0" cellpadding="8" cellspacing="8" summary="feedback form" id="table17">
<tr><td style="border-style: dotted; border-width: 1px">
	<font face="Verdana" size="1">Address 
	</font></td><td style="border-style: dotted; border-width: 1px"><font size="1" face="Verdana">
	<input type="text" name="address" size="25" /></font></td></tr>
</table>


</p>
<p dir="ltr"><font face="Verdana"><font size="2">Prices:</font>

<font style="font-size: 7pt">Please click on Quality Overview in the top menu to 
read more about the Quality and the Prices.</font></font></p>
<table border="0" cellpadding="8" cellspacing="8" summary="feedback form" id="table5" width="526">
<tr><td width="38" style="border-style: dotted; border-width: 1px; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px"><font face="Verdana" size="1">Type</font></td>
	<td style="border-style: dotted; border-width: 1px; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px">
	<font size="1" face="Verdana">
	<input type="radio" name="Type" value="DVD" checked>DVD 
	<input type="radio" name="Type" value="CD">CD
	</font></td></tr>
</table>
<table border="0" cellpadding="8" cellspacing="8" summary="feedback form" id="table6" width="526">
<tr><td width="38" style="border-style: dotted; border-width: 1px; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px"><font face="Verdana" size="1">Cover</font></td>
	<td style="border-style: dotted; border-width: 1px; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px">
	<font size="1" face="Verdana">
	<input type="radio" name="Cover" value="Plastic" checked>Hard Plastic
	<input type="radio" name="Cover" value="Nylon">Nylon</font></td></tr>
<tr><td width="38" style="border-style: dotted; border-width: 1px; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px"><font face="Verdana" size="1">Cover Image</font></td>
	<td style="border-style: dotted; border-width: 1px; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px">
	<font size="1" face="Verdana">
	<input type="radio" name="Cover Image" value="Color" checked>Color 
	High-Resolution
	<input type="radio" name="Cover Image" value="B&W">Black &amp; White</font></td></tr>
</table>


<font face="Verdana" size="1"></font></p>


<font face="Verdana" size="1"></font><font face="Verdana" size="2">Your Order</font></p>
<table border="0" cellpadding="8" cellspacing="8" summary="feedback form" id="table3">
<tr>
<td>
<textarea rows="15" cols="45" name="Order">Please type in your order or request any DVD Movie you wish.</textarea>
</td>
</tr>
</table>




<form action="feedback.php" method="post">


<input type="submit" value="Submit" /> 
<input type="reset" value="Reset" name="B1"></p>





</body>

</html>

Rawan AbuSalman is offline  
Old 07-13-2005, 07:37 AM   #2 (permalink)
 
Super Techie

Join Date: Mar 2005

Posts: 457

Rawan AbuSalman

Default

This is the HTML Code of the form that corresponds to the php script


Code:
<form action="feedback.php" method="post">
<table border="0" cellpadding="8" cellspacing="8" summary="feedback form">
<tr><td>Name:</td><td><input type="text" name="name" size="25" /></td></tr>
<tr><td>Email address:</td><td><input type="text" name="email" size="25" /></td></tr>
<tr>
<td colspan="2">
Comments

<textarea rows="15" cols="45" name="comments">
</textarea>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="submit" value="Send Feedback" />

Powered by thesitewizard.com
</td>
</tr>
</table>
</form>


The php script I got is: (it is for another form not the one I created)


Code:
*/

// ------------- CONFIGURABLE SECTION ------------------------

// $mailto - set to the email address you want the form
// sent to, eg
//$mailto		= "youremailaddress@example.com" ;

$mailto = 'rabusalman07@ic.edu.lb' ;

// $subject - set to the Subject line of the email, eg
//$subject	= "Feedback Form" ;

$subject = "Order" ;

// the pages to be displayed, eg
//$formurl		= "http://www.example.com/feedback.html" ;
//$errorurl		= "http://www.example.com/error.html" ;
//$thankyouurl	= "http://www.example.com/thankyou.html" ;

$formurl = "order.htm" ;
$errorurl = "error.htm" ;
$thankyouurl = "thanx.htm" ;

// -------------------- END OF CONFIGURABLE SECTION ---------------

$name = $_POST['name'] ;
$email = $_POST['email'] ;
$comments = $_POST['comments'] ;
$http_referrer = getenv( "HTTP_REFERER" );

if (!isset($_POST['email'])) {
	header( "Location: $formurl" );
	exit ;
}
if (empty($name) || empty($email) || empty($comments)) {
   header( "Location: $errorurl" );
   exit ;
}
$name = strtok( $name, "\r\n" );
$email = strtok( $email, "\r\n" );
if (get_magic_quotes_gpc()) {
	$comments = stripslashes( $comments );
}

$messageproper =

	"This message was sent from:\n" .
	"$http_referrer\n" .
	"------------------------- COMMENTS -------------------------\n\n" .
	$comments .
	"\n\n------------------------------------------------------------\n" ;

mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>\r\nReply-To: \"$name\" <$email>\r\nX-Mailer: chfeedback.php 2.04" );
header( "Location: $thankyouurl" );
exit ;

?>

__________________

Intel Core 2 Quad 2.4 Ghz
4 GB RAM
500 GB HD
512 MB ATI HD 2600 Pro
32" Samsung LCD
Windows Vista Ultimate
------------------------------------------------
HP Pavilion dv2000, Core 2 Duo 2.0 GHz
2 GB RAM
160 GB HD
DVD RW LightScribe
383 MB nVidia Graphics
1.3 MP Web Cam/ Fingerprint/ Bluetooth
Windows Vista Home Premium
Rawan AbuSalman is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On