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"

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

1 | 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 )

2 | 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?

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements