You are here: Re: [PHP] help for me about session « PHP « IT news, forums, messages
Re: [PHP] help for me about session

Posted by Richard Lynch on 10/30/73 11:14

On Sat, April 23, 2005 7:35 pm, Josephson Tracy said:
> hi everyone,
> when i study php, i have a problem as following:
> ---------------------
> file1.php
> <?
> if($NextCourse == 1){ do something;}
> else($NextCourse ==""){do something other }
> ?>
>
> <script language="javascript">
> function hasNextCourse(){
> document.form1.NextCourse.value = 1;

alert('Setting NextCourse to 1');

> }
> </script>
>
>
> <form name="form1" method="post" action="file1.php" onSubmit="return
> checkform()">
> <input type="hidden" name="NextCourse">
> <input type="submit" name="Submit32" value="next" onClick=" return
> hasNextCourse()">
> </form>
> -------------------------
> but when the 2ed access the file1.php
> the value of $NextCourse is the $NextCourse in the <? and ?>, Not the

There is no value give to it initially, so I'm not quite sure what you
mean...

If you have register_globals OFF, it might appear to never get set to 1,
because it's in $_POST['NextCourse'] not in $NextCourse

Your else() above isn't valud syntax...

Perhaps you should post EXACTLY what your code looks like...

> value of document.form1.NextCourse.value.
>
> could someone tell me why?thanks

This could probably be done easier, by the way, by just using:

<input type="submit" name="NextCourse" value="Click me if there is another">

and then:

<?php
if (isset($_POST['NextCourse'])){
//They clicked the button to indicate another
}
else{
//They clicked some other button
}
?>

--
Like Music?
http://l-i-e.com/artists.htm

 

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

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