Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Prepopulate a form field with data entered on a previous page  RSS feed

Angela Greig
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,, 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">
<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" />

When you get to the Newsletter Signup page,, 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 for="firstname">First Name:
<input id="firstname" name="firstname" type="text" size="50">
<label for="lastname">Last Name:
<input id="lastname" name="lastname" type="text" size="50">
<label for="company">Company:
<input id="company" name="company" type="text" size="50">
<label for="position">Position/Title:
<input id="position" name="position" type="text" size="50">
<label class="submit" for="submit">
<input id="submit" type="submit" value="Submit">

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.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!