<td nowrap>
//for clock i used javascript from http://www.javascriptkit.com/script/cut2.shtml
<input type="text" class="button" size="1" name="clock">
<select name="To" size="1" >
<option selected >8:00</option>
<option selected >9:00</option>
<option selected >10:00</option>
</select>
</td>
<td>
<? if ($_POST["To"] != "clock") {?>
<?= $line["To"] ?>
//whats wrong ib below code and how i can get value of clock when no time is selected from To files
<? if (isset($_POST["clock"]))?>//its not going to this loop
<?echo $_POST["clock"]; ?>
<? }?>
</td>
its getting only value of To field no matter whether user chooses tiem from To or running clock is there,i want something like when user not select anything from To he will get value of clock and
if i use this alone
<? if (isset($_POST["clock"]))?>//getting error
<?echo $_POST["clock"]; ?>
<? }?>
this does not make any sense, the select is not a multiple select (and size 1 anyway) so having all three items selected is not correct. It will not cause problems in IE, but is still invalid
still i dont understood what you mean even though i add the braces still is not working
i can tell u more clear
in table
<td>
one is running clock and besides that there is option to select time
</td>
and there is save button
actually why i put clock reason suppose user forget to select tiem and click on save he will get clock time else selected time
hope u understood,how i can use by PHp as isset is not working as no variable is set for clock as its pure javascript used for clock.
ok, so are you saying that there is no form field called 'clock' (except the button which will not be passed anyway I think)? If so then that value certainly won't be on the server for the PHP to see, since only values in form fields are passed when the form is submitted.
If you want to use the value from the select or a default of the current time, then any of these should work
a) have the select set to a default when the form loads - you are already doing this one anyway so 'To' cannot be unselected if the form is submitted.
b) use javascript to make sure that they select an item from the select box - only relevant if you dont do a)
c) in your php, if you dont find a 'To' value use the value of the server time (can get it using time() and reformat it using date() to the format you require).
Bookmarks