I'm a web development student and I'm trying to find a way to thank a visitor who submits a contact form from my website. I want to thank them by name on a thank you page. Below is the code of my form. please help a student learn.
<form action="http://www.MySiteUrl/cgi-sys/formmail.pl" method="post" enctype="plain/text" id="Contact">
<input name="Name" type="text" class="quoteboxes" id="Name" />
<span class="textfieldRequiredMsg">Name is required.</span></span></div>
<!-- End InputFavSite -->
<div id="inputneed">
<label>Email </label><span id="sprytextfield6">
<input name="Email" type="text" class="quoteboxes" id="Email" />
<span class="textfieldRequiredMsg">E-mail is required.</span><span class="textfieldInvalidFormatMsg">Opse! your E-mail is wrong.</span></span></div>
<!-- End InputNeed -->
<div id="inputbudjet"> <label>Phone </label><span id="sprytextfield7">
<input name="Phone" type="text" class="quoteboxes" id="Phone" />
<span class="textfieldRequiredMsg">Phone is required.</span><span class="textfieldInvalidFormatMsg">Opse! your number is wrong..</span></span></div>
<!-- End InputBudget -->
<div id="inputtime">
<label>Subject </label> <span id="sprytextfield8">
<input name="Subject" type="text" class="quoteboxes" id="Subject" />
<span class="textfieldRequiredMsg">Subject is required.</span></span></div>
<!-- End InputTime -->
<div id="ccontact"><span id="sprytextarea">
<textarea name="Message" class="quotemessase" id="Message"></textarea>
<span class="texta开发者_Python百科reaRequiredMsg">Message is required.</span></span></div><!-- End QuoteButtRight -->
<div id="contactbttn">
<input name="sender" type="submit" value="click to send your message" />
</div><!-- End ContactBttn -->
</div><!-- End QuoteTopRight-->
</div><!-- End QuoteTop -->
<input type="hidden" name="recipient" value="info@siteripe.com" />
<input type="hidden" name="redirect" value="yourURL/Thankspage" />
</form>
you can save the name value into a cookie before form is submitted (using javascript), and then fetch it from the cookie using javascript.
http://www.quirksmode.org/js/cookies.html
or use a server side language (php etc)
If you want a cheap javascript version (no server-side code), you can do something like the following:
- On submit of the form, append
?name={name here}
toredirect
variable. - On
thanks.html
, read the querystring variable and put on screen to user.
As adviced I used a PHP Form mailer, killed the line of Code that re-directs and then used
精彩评论