You are here: Re: Problems with 'if' statement « PHP Programming Language « IT news, forums, messages
Re: Problems with 'if' statement

Posted by mantrid on 08/11/06 11:52

"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
news:geudnTFQ18TRbUbZnZ2dnUVZ_sudnZ2d@comcast.com...
> mantrid wrote:
> >>I think your problem is not the if statement - I suspect $updatestats
> >>isn't being set. What code do you have that sets it?
> >>
> >
> >
> >
> > That occured to me so I tried
> >
> > <form action="<?php if(isset($_POST['updatestats'])){
> >
> > instead of
> >
> > <form action="<?php if(isset($updatestats)){
> >
> > but still no luck, but I got round it by getting rid of the 'if' in the
form
> > action and placing them at the top of the page, as below
> >
> > ****************************************************
> > if(isset($download)){
> > header("Location: http://www.mysite.co.uk/excelsave.php");
> > }
> >
> > if(isset($updatestats)){
> > script for creating confirmation version of original page
> > }
> >
> > <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"
> > enctype="multipart/form-data"> name="savestatments">
> >
> > ***************************************************
> > However I would still like to know why the first method didnt work.
> > Thanks all for the support
> >
> >
> > Ian
> >
> >
>
> Ian,
>
> Were you trying to change the action based on a click on the same page?
> If so, it won't work.


> PHP is server side. By the time the page gets to your browser, PHP has
> done its job and ended processing for this page.
>
> Your if statement should work if $_POST['updatestats'] was set when this
> page was called. But only then.
>

Yes silly me that was exactly what I was doing. and it works the second way
because when the page it resent only then does $_POST['updatestats'] have a
value. nice one, thanks
ian

 

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

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