Page 1 of 1

Submitting Script

Posted: Thu Jan 27, 2005 9:13 am
by JimmyD
Hi i have no Php experience and was wondering if there was a script where a person could submit some information on a form, and it would show up on another page.

Thanks in advance,
Jimmy

Posted: Thu Jan 27, 2005 9:22 am
by feyd
here's the basic idea

Code: Select all

<?php

if(!empty($_POST))
&#123;
  $postVars = 'Info posted:<br /><pre>'.htmlentities(var_export($_POST,true),ENT_QUTOES).'</pre>';
&#125;
else
&#123;
  $postVars = '';
&#125;

echo <<<STOP
<html>
<head>
<title>your title here</title>
<body>&#123;$postVars&#125;
<form name="Example" action="&#123;$_SERVER&#1111;'SCRIPT_NAME']&#125;" method="post">
Username: <input type="text" name="username" value="Enter your user name here" onfocus="this.value=''" /><br />
Password: <input type="password" name="password" value=" /><br />
Checkboxes: <input type="checkbox" name="checks&#1111;]" value="checkbox1" /> Checkbox 1<br />
<input type="checkbox" name="checks&#1111;]" value="checkbox2" /> Checkbox 2<br />
<input type="checkbox" name="checks&#1111;]" value="checkbox3" /> Checkbox 3<br />
Radios: <input type="radio" name="radios" value="radio1" /> Radio 1<br />
<input type="radio" name="radios" value="radio2" /> Radio 2<br />
<input type="radio" name="radios" value="radio3" /> Radio 3<br />
...<br />
</form></body>
</html>
STOP;
?>

Posted: Thu Jan 27, 2005 9:54 am
by JimmyD
thanks, but how do i use it. What i'm trying to do is let people submit their phone numbers and i want it to show up in another page.

-Jimmy