Page 1 of 1

Form to create

Posted: Sat Jun 11, 2011 8:15 am
by Xenilbohl
Well what I want to do is when someone types something into a field it changes something else in say a text box.

For example I have a sentence and it begins " My name is 'X''

Then I have a field where they type in there name and either live or they click a button and it changes the sentence. How would I do this?

Thank you.

Re: Form to create

Posted: Sat Jun 11, 2011 10:35 am
by jacek
just using $_POST['name'] you could do
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title></title>
	</head>
	<body>
		<div>
			<?php
			
			if (isset($_POST['name'])){
				echo "Your name is ", htmlentities($_POST['name']);
			}
			
			?>
			<form action="" method="post">
				<p>
					<input type="text" name="name" />
					<input type="submit" value="Update" />
				</p>
			</form>
		</div>
	</body>
</html>

Re: Form to create

Posted: Sat Jun 11, 2011 5:03 pm
by Xenilbohl
Great! Thank you jacek

Re: Form to create

Posted: Sun Jun 12, 2011 1:50 pm
by Kamal
To do it live, you must use javascript. PHP is not for client-side stuff.