scriptygoddess

10 Jun, 2003

PHP: What's coming in from the form?

Posted by: Jennifer In: Script snippet

I posted how to do this in ASP, but since I needed something similar in PHP for that last post, I thought I'd post the PHP version as well.

This script snippet will play back everything that was just submitted in the form (code found in the each function page in the PHP manual.)

<?
echo "<p>Here is the data that was submitted in the form</p>";
echo "<p>";
while(list($key,$value) = each($_POST)) {
echo $key.": ".$value;
echo "<br>";
}
echo "</p>";
?>

This assumes, in your form tag, you set method="post"

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

2 Responses to "PHP: What's coming in from the form?"

1 | huphtur

June 12th, 2003 at 2:22 pm

Avatar

how would one do this with checkboxes to make sure there is a default value in a checkbox field?

2 | Chris

June 11th, 2003 at 12:47 am

Avatar

Although not as pretty, you can use:

<?php

print_r($_POST);

?>

which will give you something like this:

Array ( [name] => Joe Schmoe [address] => 123 Any Street [city] => Anytown [state] => NY [zip] => 12312 )

Featured Sponsors


  • Michael: You can use get_header(2) in your case. The filename of your custom header has to be header-2.php. The problem with include(your_file.php) is, all
  • cliff: hi wonder if you can help me, pls i designed www.kouga.mobi using dreamweaver CS3 and now want to make the phonenumbers into links so that if you
  • jerey: how do i rewrite this because it tried RewriteEngine on #Options +FollowSymlinks RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FIL

About


Advertisements