You are here: Re: Form and If command « PHP Programming Language « IT news, forums, messages
Re: Form and If command

Posted by Erwin Moller on 12/04/06 14:47

Nico wrote:

> Dear All,
>
> I'm new in the Php world and am trying to do my first trials (with
> included errors :).
> At the present I created a simple form:
>
> <FORM METHOD="POST" ACTION="test.php">
> <INPUT TYPE="text" NAME="amount" SIZE="10" MAXLENGHT="20">
> <INPUT TYPE="SUBMIT" VALUE="SUBMIT">
> </FORM>
>
> Then, in the test.php page I've included the following code:
> <?php
> echo $_REQUEST["amount"];
> ?>
>
> In the field "amount" of the form it will be inserted a number.
> I'd like to create a string which make the following operations:
>
> if the inserted amount is < or = to 1 go to the URL http://www.....
> if the inserted amount is > 1 go to the URL http://www.....
>
> I've some problem because don't know if I can use something like "if
> "amount = 1 ... " or not.

Of course you can. PHP is a programming language, not a pocket calculator.
;-)

www.php.net is the place to be for learning about the language.
Scout around a little and look things that might interest you.

This part covers control structures, like the one you are looking for:
http://nl3.php.net/manual/en/language.control-structures.php

Also, if you need to redirect to another site, use:
header("Location: www.example.com");
exit;

(Do not forget the exit, since PHP will continue executing code after the
header.)

Regards,
Erwin Moller

> Can you help me please?
> Many thanks.
>
> All the best,
> Nico

 

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

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