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


  • Curt: If anyone comes across this with similar issues I was able to sort out the pagination issues painlessly with easyCommentsPaginate from http://www.mush
  • Christopher: Yeah, it is indeed hard to do. And something remains elusive about why the pagination never worked. I tried everything I could find. Regardless, I
  • Jennifer: Hi Christopher, always hard to bug test stuff like that remotely. Sorry those didn't help. Glad you found a solution though :)

About


Advertisements