You are here: Re: change a checkbox to clickable link? « All PHP « IT news, forums, messages
Re: change a checkbox to clickable link?

Posted by Rikoos on 01/02/07 20:31

On Tue, 02 Jan 2007 20:22:42 +0100, "J.O. Aho" <user@example.net>
wrote:

>Rikoos wrote:
>> Hi everybody,
>>
>> I have a small problem and i don't know where to start.
>>
>> The following:
>>
>> I have a running Joomla CMS system with a component eventlist which is
>> written in PHP. Members are able to select event in the agenda and
>> able to mark a check box to let others to know the will attend this
>> event (this is shown in there profile and also shown at the event
>> agenda item.
>>
>> I want to change this to a clickable link, so user don't have to mark
>> the checkbox and confirm this by clicking a button. When a member is
>> not already registered for a event there will be a clickable link with
>> something like "Add to personal agenda". If already registered a link
>> will be shown with something like "Remove from personal agenda".
>>
>> The component is generating the following code:
>>
>> <form name="Eventlist" action="index.php" method="post">
>> <input type="hidden" NAME="option" value="com_eventlist">
>> <input type="hidden" NAME="Itemid" value="56">
>> <input type="hidden" NAME="rdid" value="1573">
>> <input type="hidden" NAME="func" value="userregister">
>> Ik ga naar dit evenement: <input type="checkbox" name="reg_check"
>> onClick="check(this, document.Eventlist.senden)">
>> <br /><br />
>> <input type="submit" name="senden" value="Inschrijven " disabled>
>> </form>
>>
>> <script language="JavaScript">
>> function check(checkbox, senden) {
>> if(checkbox.checked==true){
>> senden.disabled = false;
>> } else {
>> senden.disabled = true;
>> }
>> }
>> </script>
>>
>>
>>
>>
>>
>> In the component code the following code is responsible for generating
>> the above code:
>>
>>
>> <?php
>> $jetzt = date("Y-m-d");
>> $now = strtotime($jetzt);
>> $date = strtotime($row->dates);
>> $timecheck = $now - $date;
>> if ($timecheck <= 0) {
>> if ($my->id) {
>> if (!$usercheck) {
>> if (!$usercheck) {
>> ?>
>> <form name="Eventlist" action="index.php"
>> method="post">
>> <input type="hidden" NAME="option"
>> value="<?php echo $option ; ?>">
>> <input type="hidden" NAME="Itemid"
>> value="<?php echo $Itemid ; ?>">
>> <input type="hidden" NAME="rdid" value="<?php
>> echo $row->did ; ?>">
>> <input type="hidden" NAME="func"
>> value="userregister">
>> <?php echo _EVENTS_REGISTRA_REG." "; ?>
>> <input type="checkbox" name="reg_check"
>> onClick="check(this, document.Eventlist.senden)">
>> <br /><br />
>> <input type="submit" name="senden"
>> value="<?php echo _EVENTS_REGISTRA_BUTTON." "; ?>" disabled>
>> </form>
>>
>> <script language="JavaScript">
>> function check(checkbox, senden) {
>> if(checkbox.checked==true){
>> senden.disabled = false;
>> } else {
>> senden.disabled = true;
>> }
>> }
>> </script>
>> <?php
>> } else {
>> if ($row->unregistra == 0) {
>> echo _EVENTS_REGISTRA_ALLRE." ";
>> } else {
>> ?>
>> <form name="Eventlist" action="index.php"
>> method="post">
>> <input type="hidden" NAME="option"
>> value="<?php echo $option ; ?>">
>> <input type="hidden" NAME="Itemid"
>> value="<?php echo $Itemid ; ?>">
>> <input type="hidden" NAME="rdid" value="<?php
>> echo $row->did ; ?>">
>> <input type="hidden" NAME="func"
>> value="delreguser">
>> <?php echo _EVENTS_REGISTRA_UNREG." "; ?>
>> <input type="checkbox" name="reg_check"
>> onClick="check(this, document.Eventlist.senden)">
>
><a
>href="index.php?option=$option&Itemid=$Itemid&rdid={$row->did}&func=delreguser&reg_check=1">click
>here</a>


COOL !!!

That's it, tried it and worked for unregistar and registar with a
small adjustment.

Thank you !!

Rick

 

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

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