> Does anyone have examples of using PHP to process forms? I'd also like
> to know if I can embed the code in my html file or do I have to write a
> CGI server side script to do it?
>
> Thanks,
> Don
Here's a form processor :
foreach ($HTTP_POST_VARS as $key => $value) {
print "$key : $value <br>\n";
}
See: http://www.php.net/manual/en/language.variables.predefined.php
See: http://www.php.net/manual/en/language.variables.external.php
The above assumes you aren't using array (<input name="foo[]">) and that
you're using POST method (<form method="post">) if using GET change POST
to GET. So simple yet so useful! Can it be expanded? Yes.
Yes, PHP and HTML "embed" nicely together, for example, like this :
<h3><?php print $title ?></h3>
<p>Hi, how are you <?php print $name ?> !!! I am fine.</p>
See: http://www.php.net/manual/en/language.basic-syntax.php
That assumes the file parses PHP, usually .php does this but depends on
setup. Check/ask web host or try : .php3 , .php , .phtml ... and when you
do, have your first php script be :
<?php
print '<h3>Hello World (of PHP)</h3>';
phpinfo();
?>
phpinfo is very nice, provides a lot of useful information about your
setup. And yes, the server must be setup to parse PHP and the sysadmin
must do this, an end user cannot. Information on that can be seen here :
http://www.php.net/manual/en/installation.php
Also, consider checking out basic PHP tutorials found at devshed.com and
phpbuilder.com as well as the manual at php.net/manual/
Regards,
Philip Olson
http://www.cornado.com/
On Mon, 12 Feb 2001, Sean Kennedy wrote:
> Does anyone have examples of using PHP to process forms? I'd also like
> to know if I can embed the code in my html file or do I have to write a
> CGI server side script to do it?
>
> Thanks,
> Don
>
> --
> <html>
> <body>
> <form action="your_phpscript.php" method="post">
> What's your name
> <input name="some_name" type="text">
> <input type="submit">
> </form>
> </body>
> </html>
>
> When the submit button is pressed, the value of the some_name input field is
> sent to your script. Your script can access it as a variable named
> $some_name. Example...
>
> <?php
> echo ($some_name);
> ?>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]