Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question about sending form results 1

Status
Not open for further replies.

krappleby

Programmer
Jul 25, 2006
25
GB
I have a form, which i need to send half the results to one place, and the other half to another page.. does anyone have any information or locations where i can get this info from so i can complete this task..

also if anyone has any info on how to copy info from one input text field to another automatically without using submit.
Currently i have a checkbox, (can use the on change function) or something, but need to know where i can get all the info from..


Cheeers
 
This sounds over complicated.
Where are the two destinations?

Keith
 
a single form cannot direct its output to two destinations.

however a receiving php script can do more than one thing with the data it gets, including sending some of it off to a second destination if needs be (but i agree with auiopro that this sounds like a design complication). By place here i mean url.

javascript can handle your client side interaction. have a look at the code snip below. if you want the changes to match key press by keypress then change onChange to onKeyUp

Code:
<form>
<fieldset>
<script type="text/javascript">
//<![CDATA[
	function sendvalue(val) {
		document.forms[0].elements["receiving_field"].value = val;
	}
//]]>
</script>
Type here: <input type="text" name="sending_field" onChange="sendvalue(this.value);" /><br/>
and it will appear here: <input type="text" name="receiving_field" />
</fieldset>
</form>
 
Hi jpadie

thanks for the info on the javascfript, unfortuantely i am not skilled at all in that. lol.. anyway. i have changed the script to cdo this. however i have one more question.. here is the script set for my coding

<script type="text/javascript">
//<![CDATA[
function sendvalue(val) {
document.forms[1].elements["receiving_name"].value = val;
document.forms[2].elements["receiving_name2"].value = val;
document.forms[5].elements["receiving_address1"].value = val;
document.forms[6].elements["receiving_adress2"].value = val;
document.forms[7].elements["receiving_town"].value = val;
document.forms[8].elements["receiving_postcode"].value = val;
document.forms[4].elements["receiving_email"].value = val;
document.forms[4].elements["receiving_email2"].value = val;
}
//]]>
</script>

now.. 1 more question. 1 of the fields is a textarea, which should contain

address 1
address 2
and town

how do i take the three input info and transfer it to only one text area..

Cheers
 
i'm not sure that your javascript will work.

i guess it is your intention to assign the value of sending_name to receiving_name, sending_email to receiving_email etc

in which case change the onChange event to "sendvalue(this);"

and the sendvalue function to
Code:
function sendvalue (elem) {
  var sn = new String(elem.name);
  var rn = sn.replace ("sending", "receiving");
  var v = elem.value;
  document.forms[0].elements[rn].value = v;
}
for the elements that you wish to combine just grab the values and concatenate them with "+".

if you want more help with javascript please report in the js forum. it's not that we don't want to help you but more that you will stand a better chance of getting a top class answer and other people with javascript queries are more likely to come across the solution if it is posted in the proper forum.

 
FYI, the javascript forum is here: forum216.


----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top