| Coding Forum Problems with your code? Let's hear about it. |
06-22-2004, 08:38 PM
|
#1 (permalink)
|
|
v7n Mentor
Join Date: 05-06-04
Location: London, UK
Posts: 1,452
Latest Blog: None
|
Mail Program
Hello, I'm not sure if this is the right place to post this, but I thought I could ask for some help.
I have a website and when people click on a link such as information or a product or something like that, I want a page to come up with a mail form
So they enter their email and a bunch of information about that product will be sent to their email.
I currently have a mail program working so they can send messages to my email account but when I try and edit the email address it says it can't find it on this server (being my hosting sites server)
So basicly my question is how do I get mail being sent to people outside my servers address.
(An example of the form I'm using can be found at http://www.rafelectronix.com/contact.html << **Note this page is active and does send emails to me. Its not a demo)
If what I have said doesn't make sence please say so and I will just make a demo and show you the problem ;-) Much easier that way.
|
|
|
06-23-2004, 03:32 AM
|
#2 (permalink)
|
|
Inactive
Join Date: 10-12-03
Location: Cranberry Township
Posts: 275
|
Probably need to add auth if you are using smtp.
|
|
|
06-23-2004, 06:37 AM
|
#3 (permalink)
|
|
Inactive
Join Date: 02-11-04
Location: Corpus Christi, TX
Posts: 901
Latest Blog: None
|
try posting the script that runs the mailform, not the script for any of the pages. you shouldn't have a problem with your SMTP, i've mailed externally several times. if you don't want to post it here, PM or EMAIL me and I'll see if i can help out
|
|
|
06-23-2004, 07:35 PM
|
#4 (permalink)
|
|
v7n Mentor
Join Date: 05-06-04
Location: London, UK
Posts: 1,452
Latest Blog: None
|
Thanks Richline I think you have solved my problem now
|
|
|
06-23-2004, 08:05 PM
|
#5 (permalink)
|
|
Inactive
Join Date: 02-11-04
Location: Corpus Christi, TX
Posts: 901
Latest Blog: None
|
Quote:
|
Originally Posted by mickok
Thanks Richline I think you have solved my problem now
|
i'll get you that code as soon as i can... my friggin FTP is messing up at my home/office, but when i get into the office tomorrow morning i'll hook you up... enjoy your night
|
|
|
06-23-2004, 11:39 PM
|
#6 (permalink)
|
|
v7n Mentor
Join Date: 05-06-04
Location: London, UK
Posts: 1,452
Latest Blog: None
|
Quote:
|
Originally Posted by RichlineTechnical
i'll get you that code as soon as i can... my friggin FTP is messing up at my home/office, but when i get into the office tomorrow morning i'll hook you up... enjoy your night
|
Hey don't worry about it. I found a free php script that I have uploaded and it works great. Although now I have another problem lol
When someone clicks the link say. "More Information"
I want the subject of the form to auto fill in.
The Subject box is called Subject.
So why doesn't this work..
contact.php?subject=Subject_Name
I Link like that, should that auto fill in the subject box and make it say subject name? Or is there a different identifier you must use for PHP?
|
|
|
06-23-2004, 11:53 PM
|
#7 (permalink)
|
|
Inactive
Join Date: 02-11-04
Location: Corpus Christi, TX
Posts: 901
Latest Blog: None
|
Quote:
|
Originally Posted by mickok
Quote:
|
Originally Posted by RichlineTechnical
i'll get you that code as soon as i can... my friggin FTP is messing up at my home/office, but when i get into the office tomorrow morning i'll hook you up... enjoy your night
|
Hey don't worry about it. I found a free php script that I have uploaded and it works great. Although now I have another problem lol
When someone clicks the link say. "More Information"
I want the subject of the form to auto fill in.
The Subject box is called Subject.
So why doesn't this work..
contact.php?subject=Subject_Name
I Link like that, should that auto fill in the subject box and make it say subject name? Or is there a different identifier you must use for PHP?
|
i just posted the answer in your PM but in contact.php at the top put...
[code:1:8a9672b501]<?php $subject_name = $_GET['subject_name']; ?>[/code:1:8a9672b501]
then where your textarea is, put
[code:1:8a9672b501]<textarea value="<?php $subject_name; ?>">[/code:1:8a9672b501]
|
|
|
06-24-2004, 12:06 AM
|
#8 (permalink)
|
|
v7n Mentor
Join Date: 05-06-04
Location: London, UK
Posts: 1,452
Latest Blog: None
|
Hmm I did that, and now I don't have a subject bar at all. and when I try to type out an email it says fields are missing :-s
Sorry, I'm a n00b to all this
|
|
|
06-24-2004, 06:20 AM
|
#9 (permalink)
|
|
Inactive
Join Date: 02-11-04
Location: Corpus Christi, TX
Posts: 901
Latest Blog: None
|
Quote:
|
Originally Posted by mickok
Hmm I did that, and now I don't have a subject bar at all. and when I try to type out an email it says fields are missing :-s
Sorry, I'm a n00b to all this
|
ok... send me the contact file that a user sees and fills out. the email address to and from that you want in the form and i'll send you back the two files that you need. send them through MichaelF@richline.cc You can reach me through any of the chat clients too
|
|
|
06-24-2004, 06:32 AM
|
#10 (permalink)
|
|
Potato Monster
Join Date: 03-26-04
Location: Chester, England
Posts: 3,894
|
Or use this...
Insert this code into contact.php or whatever you use. Make sure you change the forms action to your confirmation page.
Quote:
<form method="POST" action="YOUR CONFIRMATION PAGE">
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>
<input type=hidden name="ip" value="<?php echo $ipi ?>">
<input type=hidden name="httpref" value="<?php echo $httprefi ?>">
<input type=hidden name="httpagent" value="<?php echo $httpagenti ?>">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="150"> <strong>Your Name:</strong></td>
<td width="67%"> <select name="title" id="title">
<option value="Dr">Dr</option>
<option value="Miss">Miss</option>
<option value="Mr">Mr</option>
<option value="Mrs">Mrs</option>
<option value="Ms">Ms</option>
</select> <input type=text name="visitor" size="20"> <br>
<br> </td>
</tr>
<tr valign="top">
<td width="150"><strong>Your E-mail: </strong></td>
<td> <input type=text name="visitormail" size="20"> <br> <br>
</td>
</tr>
<tr valign="top">
<td width="150"><strong>Company Position:</strong></td>
<td><input name="position" type=text id="position" size="20">
<br> <br> </td>
</tr>
<tr valign="top">
<td width="150"><strong>Company Name:</strong></td>
<td><input type=text name="companyname" size="20"> <br> <br>
</td>
</tr>
<tr valign="top">
<td width="150"><strong> Telephone Number: </strong></td>
<td> <input type=text name="phoneno" size="20">
- Work<br> <br> <input name="mobile" type=text id="mobile" size="20">
- Mobile<br> <br> </td>
</tr>
<tr valign="top">
<td width="150"><strong>Contact Me By:</strong></td>
<td><p>
<label>
<input type="radio" name="contby" value="email">
E-Mail</label>
<label>
<input type="radio" name="contby" value="phone">
Telephone</label>
<br>
<br>
</p></td>
</tr>
<tr valign="top">
<td width="150"><strong>Select Query:</strong></td>
<td> <p>
<label>
<input type="radio" name="query" value="Hosting">
Hosting</label>
<br>
<label>
<input type="radio" name="query" value="Website Design">
Website Design</label>
<br>
<label>
<input type="radio" name="query" value="Website Marketing">
Website Marketing</label>
<br>
<label>
<input type="radio" name="query" value="Other">
Other</label>
<br>
<br>
</td>
</tr>
<tr valign="top">
<td width="150"><strong>Your Message:</strong><br>
Please include all relevant information...</td>
<td> <textarea name=notes rows=4 cols=26></textarea>
</td>
</tr>
<tr>
<td width="150"><br> <input name="submit" type=submit value="Send Mail"></td>
<td> </td>
</tr>
</table>
<p><br>
</p>
</form>
|
Create a new file called sendemail.php and put this into it.
Quote:
<?php
$myemail = "PUT YOUR EMAIL ADDRESS HERE";
if (!isset($visitormail))
echo "Somebody Goofed $ip" ;
$todayis = date("l, F j, Y, g:i a") ;
$subject = "Query From $visitormail" ;
$message = "
$todayis [EST] \n
From: $title $visitor ($visitormail)\n
Company: $position $companyname \n
Tel: $phoneno / Mobile: $mobile \n
Contact by: $contby \n
Product: $query \n
Message: $notes \n
\n
Additional Info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n
";
$from = "From: $visitormail\r\n";
if ($myemail != "")
mail($myemail, $subject, $message, $from);
?>
|
Then include this in your confirmation page as you specified in the form.
<?php include"sendemail.php" ?>
That should do it, you can see from the form that each section has a name, e.g. <input type=text name="visitormail" size="20">
If you look at the sendemail.php file you can see that the visitormail field is attached to the from field.
If you need any help in modifying the form or the sending page then tell me and I will help you. If you happen to have dreamweaver around you can just drop the form into there and change it as nessesary, its pretty simple.
__________________
I have become death, destroyer of worlds.
|
|
|
06-24-2004, 06:34 AM
|
#11 (permalink)
|
|
Potato Monster
Join Date: 03-26-04
Location: Chester, England
Posts: 3,894
|
BTW
<textarea value="<?php $subject_name; ?>"> is wrong;
should be; <textarea value="<?php echo "$subject_name"; ?>">
__________________
I have become death, destroyer of worlds.
|
|
|
06-24-2004, 06:54 AM
|
#12 (permalink)
|
|
Inactive
Join Date: 02-11-04
Location: Corpus Christi, TX
Posts: 901
Latest Blog: None
|
Quote:
|
Originally Posted by ncsuk
BTW
<textarea value="<?php $subject_name; ?>"> is wrong;
should be; <textarea value="<?php echo "$subject_name"; ?>">
|
sorry 3AM scripting... *yawn*
|
|
|
06-24-2004, 05:31 PM
|
#13 (permalink)
|
|
v7n Mentor
Join Date: 05-06-04
Location: London, UK
Posts: 1,452
Latest Blog: None
|
Guys thanks for your help and that script, am going to use some of those fields. I hadn't thought of asking some of that information. But it still hasn't solved my problem. I have a php script that is great. It will email anyone, but I want people to be able to click a link that says 'Email Me Information" and it will email them information about that product,
once they click the link it will take them to that contact page and auto fill in the information such as the title bar saying "Production Information: Part ##"
And then fill in some information about the product in the body part. Is there anyway to do that? Or do I have to make a new php contact page for each product?
*I hope that makes sence*
|
|
|
06-25-2004, 02:58 AM
|
#14 (permalink)
|
|
Potato Monster
Join Date: 03-26-04
Location: Chester, England
Posts: 3,894
|
Yes that easy enough.
You need to give the form fields initial values based upon when the browser tells it to do.
For example:::
You are on a page selling Bikes, There is one with a 21 inch frame and alloy wheels (Its a very nice bike)...
Anyway, you would specify the URL to the order / confirmation page as:::
contact.php?frame=21&wheels=alloy
Or something like that, you would then have the inital values set to reflect those attributes e.g.
<form name="mycontactform" method="get" action="sendemail.php">
<input type="text" name="textfield" value="<?php echo "$frame"; ?>">
</form>
If you are using PHP4 though you may have to do it like this...
<form name="mycontactform" method="get" action="sendemail.php">
<input type="text" name="textfield" value="<?php echo $_GET['title']; ?>">
</form>
If you dont understand then ask 
__________________
I have become death, destroyer of worlds.
|
|
|
06-25-2004, 06:05 AM
|
#15 (permalink)
|
|
v7n Mentor
Join Date: 05-06-04
Location: London, UK
Posts: 1,452
Latest Blog: None
|
Thank You heaps :-) Your scripts have helped me heaps and saved me a hell of a lot of time
Thank You ncsuk & RichlineTechnical
|
|
|
06-25-2004, 06:34 AM
|
#16 (permalink)
|
|
Potato Monster
Join Date: 03-26-04
Location: Chester, England
Posts: 3,894
|
Hey what else are we here for 
__________________
I have become death, destroyer of worlds.
|
|
|
06-25-2004, 02:33 PM
|
#17 (permalink)
|
|
Inactive
Join Date: 02-11-04
Location: Corpus Christi, TX
Posts: 901
Latest Blog: None
|
| |