You are here: Re: [PHP] how to exist within the context? « PHP « IT news, forums, messages
Re: [PHP] how to exist within the context?

Posted by Bing Du on 11/22/05 20:57

Thanks for the help. But I still got:

Please enter your name! Continue processing...

What I want is if no name is entered, only 'Please enter your name!'
should be returned.

Bing

David Grant wrote:

> Hi,
>
> Try this:
>
> <?php
> $submit = $_POST['submit'];
> $name = $_POST['yourname'];
>
> if ($submit)
> {
> do {
> if ($name=="")
> {
> print "Please enter your name!";
> break;
> }
> } while (0);
> }
> echo "Continue processing...";
> ?>
>
> It's a hack, but it works.
>
> Cheers,
>
> David Grant
>
> Bing Du wrote:
>
>>Hi,
>>
>>One webpage has its banner, left menu and footer ect that are controled
>>by the template. I want this php script to output the form and
>>processing result within the page structure. Without exit, if the
>>'yourname' field is empty, the script would output 'Please enter your
>>name!' fine within the page structure (that is, banner, menu and footer
>>are all there). But obviously the script does not terminate as it's
>>supposed to. With exit, the script terminates fine, but it outputs the
>>result in a page without banner, menu and footer. So what's the correct
>>way to get the script stop and output its results always in the page
>>structure.
>>
>><form method=post>
>><input name="yourname" type="text" size="20">
>><input name="submit" type="submit" value="submit">
>></form>
>>
>><?php
>>
>>$submit = $_POST['submit'];
>>$name = $_POST['yourname'];
>>
>>if ($submit)
>>{
>> if ($name=="")
>> {
>> print "Please enter your name!";
>> //exit;
>> }
>>}
>>
>>echo "Continue processing...";
>>?>
>>
>>Thanks in advance,
>>
>>Bing
>>

 

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

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