Simple FORM POST in HTML

I'd like to create a test FORM POST in HTML.  Meaning, the page I'm posting to is HTML.  I only want it to display the information from a single textbox.  Is that possible?

If not, can someone post some PHP code that is able to do this?
brettrAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

john-formbyCommented:
If you are posting to another page, you will need some sort of scripting language.  It is not possible to do with just HTML.

Please have a look at the following simple example.

Hope this helps,

John
page1.php
=========
<html>
<head>
<title>Page 1</title>
</head>
<body>
<?php
$err = $_GET['err'];
if($err == 1) {
	echo 'Error: No Username entered';
}
?>
<form action="page2.php" method="post">
Username: <input type="text" name="username" />
<input type="submit" name="submit" value="Submit" /> 
</form>
</body>
</html>




page2.php
=========
<?php
if(isset($_POST['submit'])) {
	$username = mysql_real_escape_string($_POST['username']);
	if($username == '') {
		header('Location: page1.php?err=1');
	} elseif($username != '') {
		echo '<html>
		<head>
		<title>Page 1</title>
		</head>
		<body>
		Username entered was: '.$username.'
		</body>
		</html>';
	}
}
?>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mahdi78Commented:
PHP reg.php

<?
  echo '<b>Your username:</b>'.$_POST['user_name'];
?>

HTML

<form action="reg.php" method="post">
<input type="text" name="user_name">
<input type="submit" />
</form>
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.