Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Prepopulate a form field with data entered on a previous page

 
Angela Greig
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Help. I am totally lost. I'm trying to put together a website for a friend, and the last programming class I took was Fortran, so forgive me if I don't know proper terminology.

In the footer of my index page, http://www.greig.org/mc/Morgan%20Consultants/MC/index.html, I have a box where a person can input an email address to sign up to receive a company e-newsletter. When you hit "GO" it takes you to the Newsletter Signup page.

<form action="newslettersignup.html" method="post">
<fieldset>
<legend>News Letter</legend>
<input type="text" name="email" value="Enter Email Here…" onfocus="this.value=(this.value=='Enter Email Here…')? '' : this.value ;" />
<input type="submit" name="news_go" id="news_go" value="GO" />
</fieldset>
</form>

When you get to the Newsletter Signup page, http://www.greig.org/mc/Morgan%20Consultants/MC/newslettersignup.html, I want the form to pre-populate the Your Email field with the email that the user previously entered in the footer of the index page. Here's the code for my form:

<form method="post" action="sendmail.php">
<fieldset id="formplusreply">
<legend>Newsletter Signup</legend>
<label for="email">Your Email:
<input id="email" name="email" type="text" size="50">
</label>
<label for="firstname">First Name:
<input id="firstname" name="firstname" type="text" size="50">
</label>
<label for="lastname">Last Name:
<input id="lastname" name="lastname" type="text" size="50">
</label>
<label for="company">Company:
<input id="company" name="company" type="text" size="50">
</label>
<label for="position">Position/Title:
<input id="position" name="position" type="text" size="50">
</label>
<label class="submit" for="submit">
<input id="submit" type="submit" value="Submit">
</label>
</fieldset>
</form>


I know I need to pass some variable, but I have no idea how to modify the code to do so, and I can't find explicit help on the web. Thanks for any help you can provide.

Angela
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic