Member_2_6479049
asked on
HTML- PHP onClick Event Doesn't Work
Hi guys,
I'm using 'onClick' event in html & php but it doesn't work the way I need, actually, what I'm doing is a calendar so when people click on any day, the number of day is stored on a variable but when I echo the variable $diaseleccionado, always shows the last day, but not the day I clicked.
Please any ideas on this matter?
This is the part of code and it shows from day 1 to 31.
I'm using 'onClick' event in html & php but it doesn't work the way I need, actually, what I'm doing is a calendar so when people click on any day, the number of day is stored on a variable but when I echo the variable $diaseleccionado, always shows the last day, but not the day I clicked.
Please any ideas on this matter?
This is the part of code and it shows from day 1 to 31.
//-------------------------------DIA 30 PARA DIBUJAR EL CALENDARIO
if(substr("$dia30",0,1) == "N") {
?><TD height="30" ALIGN=center bgcolor="#666666">30</a></TD><?php
}else{
if(substr("$dia30",0,1) == "L") {
?><TD height="30" ALIGN=center bgcolor="#E1FFE1"><a href="#" onClick="<?php $diaseleccionado = 30; ?>">30</a></TD><?php
}else{
if(substr("$dia30",0,1) == "C") {
$totalcitaxpordia = substr("$dia30",1);
if ('$totalcitaxpordia' <= '$total_citas_por_dia') {
?><TD height="30" ALIGN=center bgcolor="#990000">30</a></TD><?php
}else{
?><TD height="30" ALIGN=center bgcolor="#E1FFE1"><a href="#" onClick="<?php $diaseleccionado = 30; ?>">30</a></TD><?php
}
}
}
}
//-------------------------------DIA 31 PARA DIBUJAR EL CALENDARIO
if(substr("$dia31",0,1) == "N") {
?><TD height="30" ALIGN=center bgcolor="#666666">31</a></TD><?php
}else{
if(substr("$dia31",0,1) == "L") {
?><TD height="30" ALIGN=center bgcolor="#E1FFE1"><a href="#" onClick="<?php $diaseleccionado = 31; ?>">31</a></TD><?php
}else{
if(substr("$dia31",0,1) == "C") {
$totalcitaxpordia = substr("$dia31",1);
if ('$totalcitaxpordia' <= '$total_citas_por_dia') {
?><TD height="30" ALIGN=center bgcolor="#990000">31</a></TD><?php
}else{
?><TD height="30" ALIGN=center bgcolor="#E1FFE1"><a href="#" onClick="<?php $diaseleccionado = 31; ?>">31</a></TD><?php
}
}
}
}
?> </TR>
<TR> <?php
?> </TR>
</table>
<table width="280" border="0" align="center">
<tr>
<td><div align="center">
<input type="submit" name="Submit" value="Asignar horario">
</div></td>
</tr>
</table>
<?php
if(isset($_POST['Submit'])) {
echo "$diaseleccionado";
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Don't be sad: you'll learn a lot of interesting and magic things! :-)
ASKER
Thank you guys,
I already change the way to do that, because I had not to much time to fix the problem.
Thank you again.
I already change the way to do that, because I had not to much time to fix the problem.
Thank you again.
elm9999, I find surprising you have downgraded our answers: if Php has not an onclick event it's not up to us! Or do you think we should rewrite Php to make you happy? ;-)
ASKER
:(