Re: help for me about session
| From: | Richard Lynch | Date: | Sun, 24 Apr 2005 23:52:53 +0000 |
| Subject: | Re: help for me about session | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-213764@lists.php.net to get a copy of this message | ||
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