abhijitp Posted August 6, 2009 Share Posted August 6, 2009 Hi, I am a newbie and have very little knowledge of PHP. I want to create dependencies on links using a checkbox (or any easier tool). Eg: Link 1 Link 2 Link 3 If the checkbox on link 2 is clicked, then the link 2 should not be active unless Link 1 in opened. Where as Link 3 should be accessible. I have written below code: /* Loop for No. of items/links */ $counter = 0; foreach ($item as $item_id => $details) { if($details['visible'] == 0) { continue; } $counter++; /*Checkbox created */ $typec = "Checkbox"; $namec = "formDoor[]"; $valuec = ""; $checking = "<form method=".'POST'.">". "<input type="."'".$typec."'"."name="."'".$namec."'"."value=".$valuec." />". "</form>"; /*Dependency condition */ $dsp_ord = ''; $aDoor = $_POST['formDoor']; $result = ""; if(is_null($aDoor)) { $result = '<td align="left" valign="top">'.'<a href="#" onClick="javascript:window.open('."'".$url."'". ",'mywindow1','width=1000, height=600'".');">'.$url_name . '</a>' . "</td>\n"; } else { $result = '<td align="left" valign="top">'.'<a href="#">'.$url_name . '</a>' . "</td>\n"; } With above code the checkbox only appears but doesnt do anything when the page is reloaded, the checkbox is also reloaded. It doesnt get saved. Link to comment https://forums.phpfreaks.com/topic/169083-checkbox-in-php/ Share on other sites More sharing options...
abazoskib Posted August 6, 2009 Share Posted August 6, 2009 you need to get the checkboxes status either with $_GET or $_POST Link to comment https://forums.phpfreaks.com/topic/169083-checkbox-in-php/#findComment-892096 Share on other sites More sharing options...
abhijitp Posted August 7, 2009 Author Share Posted August 7, 2009 Can you share any example. I really dont know how to use it. Link to comment https://forums.phpfreaks.com/topic/169083-checkbox-in-php/#findComment-892669 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.