Re: help for me about session

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux