I have little experience with php & javascript hybrid pages. A friend has a webform php page that has the html form code at the bottom. The form works well but I want to take the first input text field and have it displayed in a <div> on the page the form is directed to. I have tried a few things but can't get it to work. Can anyone help please.

Recommended Answers

All 3 Replies

I already wrote something like this.

function moveText(text, dispField, defaultText) {
	if (text.length < 2) {
		text = defaultText;
	}
	document.getElementById(dispField).innerHTML = text;
}

usage:

<input type="text" name="fname" id="fname"  onkeyup="moveText(this.value, 'result', 'First Name')" onblur="moveText(this.value, 'result', 'First Name')" />

the 'result' is the ide of the div that i want to show the text in.
Using it the way i have it will allow it to change live, after more than 2 characters are entered the content of thr div will change as the user types.
The point of the onblur is that if some users type fast they will type too fast for the script to function and some letter will be cut off. Calling it again onblur will just update the div with the data.

I think this is what you wanted, this is for the content to be moved on the same page. If you want a form element to be displayed in a div on the submitted page, just use the $_POST method to populate the field.

If this still isn't what you want, please explain in more detail.

Thanks I will give that a try.

No I couldn't make it work. These are the lines in the php form page which I think are relivant. There are 14 text input fields on the form and I need them all to go off to the email and the name field to also go the next page.

<form method="post" action="" enctype="multipart/form-data">

<input type="text" name="FieldData0" value="<? echo $FieldData[0] ?>" maxlength="100" size="30" /><? echo ' ' . $mmsg[1];
?>

and the submit button

<input type="text" name="hida2" value="" maxlength="100" size="3" style="display : none" />
<input type="submit" class="btn" value="SUBMIT" name="Submit" />

The following web site name appears in the php code at the top at the page after $FWebsiteAfter =

I have a div set up on the second page which I want the name to appear.

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.