You are here: Re: Getting variable names passed to form in php « PHP Programming Language « IT news, forums, messages
Re: Getting variable names passed to form in php

Posted by Lars Eighner on 10/14/07 13:23

In our last episode,
<1192363546.396880.170780@q3g2000prf.googlegroups.com>,
the lovely and talented william.hooper@gmail.com
broadcast on comp.lang.php:

> Oh thankyou but I am tearing my hair out.

> I have this html:

><html>
><head></head>
><body>
><FORM ACTION="test.php"><INPUT TYPE=SUBMIT NAME="hello"
> VALUE="Delete"> </FORM>
></body>
></html>

> and if I make test.php this:

><?php

> echo 'Hello World!';

> ?>

This works perfectly. Of course since method defaults to GET, this won't
work at all without a server (in most or all browsers). If you use
method="POST", it will work (sort of) without a server in many browsers
(some will complain 'POST not supported' because there is not a server to
post to) but it should take you to test.php --- which looks blank because
without a server, there is nothing to execute your php. But if you show
source you will find you are in the right place.


> but when I try your code it's just blank. in fact i am struggeling to
> get anything except this hello world example to work and i have tried
> a few from the internet. it's killing me (i am not stupid - lots of c#
> experience):

That explains it.



><?php
> if(!empty($_POST)){
> foreach($_POST as $key => $value){
> //'hello' should be a key:
> echo "$key:$value\n";
> }

> }
> ?>


or you could use array_keys. Look it up in the manual.


--
Lars Eighner <http://larseighner.com/> <http://myspace.com/larseighner>
Countdown: 464 days to go.
What do you do when you're debranded?

 

Navigation:

[Reply to this 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

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