Welcome to WebmasterWorld Guest from 54.167.177.207

Forum Moderators: coopster & jatar k & phranque

Form Mail - Sending a Phone Number

   
1:10 pm on Aug 3, 2010 (gmt 0)



Hi there, I have got formmail working on a contact form, but when the email comes through, it does not display a phone number, when it is added.

Can anyone shed any light?

Please see both the HTML and the PL script

<form action="chfeedback.pl" method="POST">
<table border="0" cellpadding="8" cellspacing="8" summary="feedback form">
<tr><td><label for="tswname">Name</label>:</td><td><input type="text" name="fullname" id="tswname" size="25" /></td></tr>
<tr><td><label for="tswemail">Email address</label>:</td><td><input type="text" id="tswemail" name="email" size="25" /></td></tr>
<tr><td><label for="tswphone">Telephone Number</label>:</td><td><input type="text" id="tswphone" name="phone" size="25" /></td></tr>
<tr>
<td colspan="2">
<label for="tswcomments">Comments</label><br />
<textarea rows="15" cols="45" name="comments" id="tswcomments"></textarea>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="submit" value="Submit" /><INPUT value=Reset type=reset /><br />
</td>
</tr>
</table>
</form>




PL File

# ---------- USER CONFIGURATION SECTION ---------------
# Before this script will do anything useful, the following
# variables must be set.
#
# MANDATORY VARIABLES
# $mailprog - the location of your mail program and the parameters
# to pass to it.
#eg $mailprog = "/usr/lib/sendmail" ;
# $mailto - email address where the feedback will be sent
# eg, $mailto = 'yourname@example.com' ;
# $subject - the subject line in the email sent by the feedback form
# eg $subject = "Feedback Form" ;
#
# $formurl - the URL of your feedback form
# eg $formurl = "http://www.example.com/feedback.html" ;
# $thankyouurl - the URL of your thank you page
# eg $thankyouurl = "http://www.example.com/thanks.html" ;
# $errorurl - the URL of your error page
# eg $errorurl = "http://www.example.com/error.html" ;

$mailprog = "/usr/lib/sendmail" ;
$mailto = 'info@domain.co.uk' ;
$subject = "Contact Form" ;
$formurl = "http://www.domain.co.uk/contact.htm" ;
$errorurl = "http://www.domain.co.uk/error.htm" ;
$thankyouurl = "http://www.domain.co.uk/received.htm" ;


I would really appreciate some help on this.. I cant seem to find any info on this.

Thanks in advance

Steve
2:47 pm on Aug 3, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



That's not the part of the perl script that does the mail sending. Look for "fullname" in the script and see wether you can figure out how to enter the phone in the email or post the lines surrounding that.
7:39 pm on Aug 5, 2010 (gmt 0)



thanks have sorted that now... but now have another issue. The site i am creating has 3 or 4 different forms on it. The next one has a drop down box, that they have to select a country. How can I get this info to show on the email? i have put the line in

<td><input type="text" id="tswCountry" name="Country" size="25" /></td>

But it doesnt seem to show anything that they have selected, ie England, Wales, Germany, Scotland etc... Sure I have it wrong somewhere ! Any help is appreciated

Steve
7:48 pm on Aug 5, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



That's an input-field, a drop down would be a <select>-element. Have you added that to your form?
8:45 pm on Aug 5, 2010 (gmt 0)



no -where would that go, or what would the code be for that?
9:27 pm on Aug 5, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



depending on how your script works, it might be enough to throw in
<select name="country">
<option value="uk">UK</option>
<option value="de">Germany</option>
<option value="fr">France</option>
</select>


You should look at (x)HTML if you want to do more fancy stuff on your form.
9:33 pm on Aug 5, 2010 (gmt 0)



Yeah, I already have this in the form... I just cant seem to get it to send the selection through the formmail script... I dont know what the code will be either in the .pl or if it goes in the HTML

 <td><font face="Verdana"><font size="2"><strong><label for="tswcountry">Country</label>         </strong></font></font></td>
<td><select name="Country">
<option value="England" selected="selected">England</option>
<option value="Northern Ireland">Northern Ireland</option>
<option value="Scotland">Scotland</option>
<option value="Wales">Wales</option>
<option value="Republic of Ireland">Republic of Ireland</option>
<option value="Netherlands">Netherlands</option>
<option value="Germany">Germany</option>
</select><br />
</td>


Regards

Steve
9:42 pm on Aug 5, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



the code to include the selected value in the email goes into the perl file that handles the form.
The value is sent the same way as a text-input would be, so just copy one of those that works and change the name.
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month