Reply to Re: how to tell if a form has been posted

Your name:

Reply:


Posted by scott Johnson on 10/13/16 11:29

I always set a hidden field

<input name="action" type="hidden" id="action" value="submit">

Then check if it has been set:

if(isset($_POST['action'])){
## Do whatever
}

Or check specifically:
if($_POST['action'] == 'submit'){
## Do whatever
}

Just to look at the variables for debugging I use:

print_r($_POST);

To use them I use foreach:

foreach($_POST as $key=>$value){
## Examine $key or $value
}
Hope this helps.

Zoe Brown wrote:
> I have a php script which includes a form. The form is submitted to itself
> and I need the php page to know if it has a form. If the form has been
> submitted the page will display differently.
>
> How do I check to see if a form has been posted and is there an easy way to
> loop through all the posted values and spit out their names and the value ?
>
> Zoe
>
>

--
Scott Johnson
http://www.seaforthsailingclub.com

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация