 |
 |
 |
 |
September 21st, 2005, 04:29 AM
|
#1
|
|
Registered User
Join Date: Sep 2005
Location: Townsville/Australia
Posts: 4
|
PHP help need for form ?
Hi guys i'm new to the forum, my question is i'm setting up a php feedback form, can someone tell me wen i'm usng textarea in dreamweaver when you submit the form it willgo my mailthanks page when your doing 4 _ REQUEST i'm using 1textarea 5 input text for the form plus 1 dropdown list 2 radio buttons can someone help us out here not sure on what to do.
PHP Code:
$E-mail = $_REQUEST['E-mail'] ; $Message = $_REQUEST['Message'];
is there any ip-script where i can track there ip address in the feedback form...

|
|
|
September 22nd, 2005, 03:27 AM
|
#2
|
|
Registered User
Join Date: May 2004
Posts: 70
|
Heh it's late now so I can go into detail and show you some code to do this but it depends on what you name your input's and what method you are submitting form as. The $_POST or since you use it $_REQUEST['name'] depends on the input so for something to fill in that variable you make <input type="text" name="name"> and that variable will have whatever was typed into put in there. Just put all the fields into variables (might have to do some if statements for the radio/dropdown) and then have it mail you all the variables. I will post an example tomorrow.
|
|
|
September 22nd, 2005, 03:38 AM
|
#3
|
|
Registered User
Join Date: Sep 2005
Location: Townsville/Australia
Posts: 4
|
Quote:
|
Originally Posted by Marshall
Heh it's late now so I can go into detail and show you some code to do this but it depends on what you name your input's and what method you are submitting form as. The $_POST or since you use it $_REQUEST['name'] depends on the input so for something to fill in that variable you make <input type="text" name="name"> and that variable will have whatever was typed into put in there. Just put all the fields into variables (might have to do some if statements for the radio/dropdown) and then have it mail you all the variables. I will post an example tomorrow.
|
Thank bud was not to sure. i've got the website done by my webdesinger but i need to learn how forms work. that way i learn a thew things... 
|
|
|
September 25th, 2005, 02:18 AM
|
#4
|
|
Registered User
Join Date: May 2004
Posts: 70
|
Sorry for delay, got caught up with some stuff irl. Here is an example form you can use (would need to be adjusted for your page/email:
Code:
<?php
// Get their IP Address
$address = getenv("REMOTE_ADDR");
//Put your email here to receive the email
$receiver = "youremail@yourdomain.com";
// Check to make sure submit was clicked
if(isset($_POST['submit'])){
// Check for the 1 hour delay cookie
if(isset($HTTP_COOKIE_VARS["ContactDelay"])){
$cook = $HTTP_COOKIE_VARS["ContactDelay"];
}
// Get all posted information
$subject = $_POST['subject'];
$name = $_POST['name'];
$email = $_POST['email'];
$body = $_POST['body'];
// Spit out error if they have sent a contact request in last hour
if($cook == "set"){
echo "You have already sent one email in the last hour, please wait one hour before each email sent.";
}else{
setcookie("ContactDelay", "set", time()+3600); /* Expires in 1 hour */
// Mail the information to you
mail($receiver, $subject, "$email a.k.a. $name sent a message from $address saying:
-------------------------------------------------------------------
$body", "From:$email"); //Send Mail, will look like "someone@domain.com a.k.a. bob sent a message from 12.32.44.154 saying: "Their message"" in the email
echo 'Thank you for contacting us, we will reply shortly.'; // Thank-you Message
}
}
?>
then for the html you would put a page that had this form in it:
Code:
<form method="post" action="SCRIPTSNAME.php">
<br>Your Name:
<br><input type="text" name="name" size="45"> <br>
<br>Your Email:
<br><input type="text" name="email" size="45"> <br>
<br>Question:
<br><input type="text" name="subject" size="45"> <br>
<br>Details:
<br><textarea name="body" cols="40" rows="10"></textarea>
<br><input type="submit" name="submit" value="Submit">
<input type="reset" name="reset" value="Reset Form">
</form>
With the radio buttons it will act like above since when you grab the $_POST variable it will only give the value of the one selected. The same works for drop downs.
|
|
|
September 25th, 2005, 07:42 PM
|
#5
|
|
Registered User
Join Date: Sep 2005
Location: Townsville/Australia
Posts: 4
|
Hi Marshall sorry for not getting i had other duity calls to attend to I've copy and paste the for that i'm going to use now that i now how to work the forum. withe the php script that you gave me i save that in another file don't i. say like in a notepad and then bring it into dreamweaver. just want to make sure i run a small isp business from selling dialup and boardband connections. i'm also hoping to get a dating service runing and a auctions site like ebay see what happens in the next 12 months. how you like my form layout was my firs one.
HTML Code:
<form action="http://www.souterncrossconnections.com.au/mailthanks.php" method="post" enctype="multipart/form-data" name="webmasters" target="_self">
<div align="center">
<table width="555" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="555"><table width="554" border="0" cellspacing="1" cellpadding="0">
<tr>
<td width="117" align="right" valign="middle"><div align="right"><strong>Name:</strong></div></td>
<td width="434"><input name="Name:" type="text" id="Name:3" size="35" maxlength="25">
</td>
</tr>
</table></td>
</tr>
</table>
<table width="555" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="119" height="23" align="right" valign="middle"><div align="right"><strong>Sirname:</strong></div></td>
<td width="436"><input name="Sirname:" type="text" id="Sirname:2" size="35" maxlength="25"></td>
</tr>
</table>
<table width="555" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="119" height="22" align="right" valign="middle"><div align="right"><strong>E-mail
Address:</strong></div></td>
<td width="436"><input name="E-mail Address:" type="text" id="E-mail Address:2" size="35" maxlength="30"></td>
</tr>
</table>
<table width="555" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="119" height="22" align="right" valign="middle"><div align="right"><strong>Phone
Number:</strong></div></td>
<td width="436"><input name="Phone Number:" type="text" id="Phone Number:2" value="+61." size="35" maxlength="15">
</td>
</tr>
</table>
<table width="555" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="119" align="right" valign="middle"><div align="right"><strong>Domain
Name:</strong></div></td>
<td width="436"><input name="Domain Name:" type="text" id="Domain Name:2" value="http://" size="35" maxlength="50"></td>
</tr>
</table>
<table width="555" border="0" cellspacing="0" cellpadding="1">
<tr>
<td width="116" height="26" align="right" valign="middle"><p><strong>
Department:</strong></p></td>
<td width="435"><select name="Department:" id="select">
<option>[ Please Select ]</option>
<option value="feedback@southerncrossconnections.com.au">Feedback</option>
<option value="sales@southerncrossconnections.com.au">Sales</option>
<option value="accounts@southerncrssconnections.com.au">Billing</option>
<option value="admin@southerncrossconnections.com.au">System Admin</option>
<option>Technical Support</option>
<option value="webmaster@southerncrossconnections.com.a">Webmasters</option>
</select> </td>
</tr>
</table>
<table width="554" border="0" cellspacing="0" cellpadding="1">
<tr>
<td width="116" align="right" valign="top"><div align="right"><strong>Message:</strong></div></td>
<td width="434"><textarea name="Message" cols="50" rows="10" id="textarea"></textarea></td>
</tr>
</table>
<table width="554" border="0" cellspacing="2" cellpadding="1">
<tr>
<td width="130" height="21" align="right" valign="middle">Feedback Relates
To</td>
<td width="414" align="left" valign="middle"><input type="radio" name="radiobutton" value="Southerncrossconnections">
Southerncrossconnections</td>
</tr>
</table>
<table width="554" border="0" cellspacing="0" cellpadding="1">
<tr>
<td width="134" height="21"> </td>
<td width="416" align="left" valign="middle"><input type="radio" name="radiobutton" value="Southerncrossconnections forums">
Southerncrossconnections Forums</td>
</tr>
</table>
</div>
<p align="center">
<input type="submit" name="Submit" value="Submit">
</p>
<p> </p>
<p> </p>
<tr>
<td valign="top"> </td>
</tr>
<p align="center"> </p>
</form>
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 08:44 AM.
|
|
 |
 |
 |
 |
|