Jump to content


This topic is now archived and is closed to further replies.


Copy a field value

Recommended Posts

I'm sure there is an easy solution to my problem.

I have a simple form.

In it I have a drop down menu, user to select a text value. This to go to field1

How do I copy the text value entered into field1 into field2?

I am a complete novice. If you can help please give me lots of detail.

Share this post

Link to post
Share on other sites
Ok, if i understand your correctly, you have a drop down box with a list of things in it. When one of these is selected you want that value to go into a text box?

<script type="text/javascript" language="JavaScript"><!--
function change()
document.form.textfield.value = document.form.select.value
// --></script>

<FORM ACTION="actionofyourfrom" METHOD="POST" NAME="form">
<SELECT NAME="select" ONCHANGE="change()">
//All your values in your drop down box
<INPUT TYPE="TEXT" NAME="textfield">

Edit: please note, im no javascript expert. Its largely a mystery to me

Share this post

Link to post
Share on other sites
To be clear on what Im trying to do.

The user will select a value from a drop down list. That text value goes into field1. I can do this in PHP

Before the form is entered I want to copy the field1 value to field2.

That way I end up with the same value in two fields in my form query.

Share this post

Link to post
Share on other sites
[!--quoteo(post=365674:date=Apr 17 2006, 03:44 PM:name=GingerRobot)--][div class=\'quotetop\']QUOTE(GingerRobot @ Apr 17 2006, 03:44 PM) [snapback]365674[/snapback][/div][div class=\'quotemain\'][!--quotec--]
You will need to use javascript for this, not php.

ya php works..... look here...
heres one in action! [a href=\"http://www.mattswebpage.com/test/testvalue.php\" target=\"_blank\"]http://www.mattswebpage.com/test/testvalue.php[/a]


<form name="form" method="get" name="form">
  <p><select size="1" name="test1">
  <p><input type="submit" value="Submit" name="submit"></p>




echo "<input type=text name=show size=20 value=$tt readonly>";


Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.