homepage Welcome to WebmasterWorld Guest from 54.166.100.8
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

    
Form Mail - Sending a Phone Number
stevebmth




msg:4181125
 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

 

janharders




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

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.

stevebmth




msg:4182714
 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

janharders




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

That's an input-field, a drop down would be a <select>-element. Have you added that to your form?

stevebmth




msg:4182757
 8:45 pm on Aug 5, 2010 (gmt 0)

no -where would that go, or what would the code be for that?

janharders




msg:4182780
 9:27 pm on Aug 5, 2010 (gmt 0)

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.

stevebmth




msg:4182784
 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

janharders




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

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved