Jump to content

doug007

Members
  • Posts

    62
  • Joined

  • Last visited

    Never

Everything posted by doug007

  1. Thanks Jay. parse_str is a nice little function
  2. ok this isn't working it errors out: Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1 $pattern='/^?[^=]+=(.*)$/'; if(preg_match($pattern, "home", $matches)){ //$this->page=$this->urlpage; var_dump($matches); }
  3. hi guys, give this string ?page=home how would you match/get anything after the = sign? thanks
  4. great this actually works. but its taking a little to close, can this be improved?
  5. Hi Guys, I'm trying to close a window without getting the prompt. i am using this code: function NoConfirm(){ window.opener = top; window.close (); } window.onLoad = NoConfirm; </script> </head> <body onLoad="popup(); NoConfirm(); window.close();"> [/code/
  6. sorry adam my bad. i found a way around this problem, but this leads me to another question? is it possible to actualy edit the a popup window so it does not show the top part of the window and the borders, so say i have form on the popup i only want that to be visiable and nothoing else?
  7. thats cool, but I want to remain on the same window and the page does not have reload, hence why we using #
  8. here is live demo: http://www.pat-burt.com/csspopup.html#
  9. this is how i am calling it: <a href="#" onclick="popup('popUpDiv')">popup</a>
  10. thanks, the problem appears to be that the url is not sent over to the popup. so how would i go about sending the url to the popup, how can i modify the js. sadly i am not js guru....any help would really appriciated. thanks
  11. okay here i tested and it worked <script language="javascript" type="text/javascript"> var strurl=window.location.href+""; var splitted=strurl.split("#"); alert(splitted[1]); </script> but it does not work on the popup window. initially the url is this: http://wtgforum-internal/index.php?action=calendar# when you click on a link to create the popup <a href="<?=$url?>" onclick="popup('popUpDiv')"><?=$title?></a> it creates a popup, then the url on the parent window chnages to this http://wtgforum-internal/index.php?action=calendar#222222 and your script only prints out 'undefined' on the popup window. the js the creates the popup is here function toggle(div_id) { var el = document.getElementById(div_id); if ( el.style.display == 'none' ) { el.style.display = 'block';} else {el.style.display = 'none';} } function blanket_size(popUpDivVar) { if (typeof window.innerWidth != 'undefined') { viewportheight = window.innerHeight; } else { viewportheight = document.documentElement.clientHeight; } if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) { blanket_height = viewportheight; } else { if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) { blanket_height = document.body.parentNode.clientHeight; } else { blanket_height = document.body.parentNode.scrollHeight; } } var blanket = document.getElementById('blanket'); blanket.style.height = blanket_height + 'px'; var popUpDiv = document.getElementById(popUpDivVar); popUpDiv_height=blanket_height/2-350;//150 is half popup's height popUpDiv.style.top = popUpDiv_height + 'px'; } function window_pos(popUpDivVar) { if (typeof window.innerWidth != 'undefined') { viewportwidth = window.innerHeight; } else { viewportwidth = document.documentElement.clientHeight; } if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) { window_width = viewportwidth; } else { if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) { window_width = document.body.parentNode.clientWidth; } else { window_width = document.body.parentNode.scrollWidth; } } var popUpDiv = document.getElementById(popUpDivVar); window_width=window_width/2-150;//150 is half popup's width popUpDiv.style.left = window_width + 'px'; } function popup(windowname) { blanket_size(windowname); window_pos(windowname); toggle('blanket'); toggle(windowname); }
  12. this is taken soo much hair of my head....but yeah lets see if someone here has come across something similar... cheers guys
  13. split a url by "#" and get the array of index 1 how do i do this?
  14. the popup pops up and i the url of the parent window changes from: http://wtgforum-internal/index.php?action=calendar# to http://wtgforum-internal/index.php?action=calendar#222222 so i wan to grab the latter
  15. ok i see what the problem is now. i am opening a popup window and the url changes from initialy being http://wtgforum-internal/index.php?action=calendar# to http://wtgforum-internal/index.php?action=calendar#222222 so hence why it does not grab the #222222 how can i fix this?
  16. sorry that was a typo on my part, thanks though. please anyone else out there who's done something like this before?
  17. Hi Guys, I am desperatly seeking a solution to how I can grab the anything after # sign on a url. so given this url: http://wtgforum-internal/index.php?action=calendar#222222 i want to grab everything after the # sign and input that into a input fields value? i have been playing aroung with windos.locationhash but this only gets me as far as the # sign. so doing a document.write(windows.location.hash) only prints out everything upto #
  18. Ok the problem with placing the echo statement outside the if statement now is that it echos this: > > > > > > > > > > > > > > > > > > > checked="checked"> checked="checked"> next to each checkbox that is checked, but does not check the actual checkbox.
  19. same problem as above. here is my entire code, its little long, but really would appriciate if anyone cared to look at it. function do_checkboxes($userid){ global $profile_info, $setting, $smarty_object, $user_info;; if(isset($_POST['set_options'])){ if(!$_POST['c_options']==""){ foreach($_POST['c_options'] as $key=>$value) { $tag_name=mysql_real_escape_string($_POST['tag_name'][$key]); $id=mysql_real_escape_string($value); $delete = "DELETE FROM tags_options where user_id = '".$user_info[user_id]."' and tag_id <> '".$id."'"; $deleteSQL = mysql_query($delete) or die(mysql_error()); //echo $deleteSQL.'<br />'; } foreach($_POST['c_options'] as $key=>$value) { $tag_name=mysql_real_escape_string($_POST['tag_name'][$key]); $id=mysql_real_escape_string($value); $oaction = "INSERT INTO tags_options (tag_id, tag_name, user_id) VALUES('$id', '".$tag_name."', '".$user_info[user_id]."')"; // echo $oaction.'<br />'; $optionsSQL = mysql_query($oaction) or die(mysql_error()); } if($optionsSQL){ echo '<font color=red>Your options have been saved</font>'; } } } $query ="SELECT tag_desc_id, tag_name, parent_id FROM tags_description ORDER BY tag_name ASC"; $result = mysql_query($query); if (!$result){ echo mysql_error(); } elseif(mysql_num_rows($result)<=0){ //echo "No entries"; }else{ echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"10\">"; echo "<form method=\"post\">"; $i=0; while ($row = mysql_fetch_array($result)) { $i++; $incr = ($incr == 3) ? 1 : $incr + 1; if($incr == 1) echo "<tr>"; echo "<td class=\"formcheckbox2\">"; $query2 ='SELECT tag_options_id, tag_id, tag_name, user_id FROM tags_options'; $result2 = mysql_query($query2); if (!$result2){ echo mysql_error(); } echo"<input name=\"c_options[$i]\" style=\"border-style: solid; border:0px solid; border-color: #FFFFFF\" type=\"checkbox\" border=\"0\" value=\"".$row['tag_desc_id']."\""; $checked = ''; while ($row2 = mysql_fetch_array($result2)) { if($row2['tag_id'] == $row['tag_desc_id'] && $row2['user_id'] == $user_info[user_id]){ //global $checked; $checked = 'checked="checked"'; echo " $checked> </input>"; } } echo"<input type=\"hidden\" name=\"tag_name[$i]\" value=\"".$row['tag_name']."\"></input>"; echo $row['tag_name']; echo "</td>"; if($incr == 3) echo "</tr>"; } echo "<tr>"; echo "<td> <input type=\"hidden\" name=\"set_options\" value=\"set_options\"> <input name=\"GO\" type=\"submit\" id=\"GO\" value=\"Save Changes\" class=\"button\">"; echo"</td>"; echo "</tr>"; echo "</form>"; echo "</table>"; } }/*
  20. sorry i meant to say it only shows checked checkboxes now not unchecked ones?
  21. thanks WolfRage, this works, but the type type=\"checkbox\" is no longer wokring?
  22. this sounds possible, but how do i fix this? i need while loop to only loop through what is checked and if checked mark each checkbox as checked? cheers
  23. yes i need my while loop there, but what do you mean with modifying my echo statement appropriatley?
  24. Hi Guys, I have the below code that returns a checkbox as checked if it matches a certain condition. i have embaded the php into the html opening and closing tags like below, but whenever somthing is checked instead of making a checkbox just check it is aslo echoing this "checked> " next to the checkbox. does anyone please know what i am doing wrong? echo"<input name=\"c_options[$i]\" style=\"border-style: solid; border:0px solid; border-color: #FFFFFF\" type=\"checkbox\" border=\"0\" value=\"".$row['tag_desc_id']."\""; $query2 ='SELECT tag_options_id, tag_id, tag_name, user_id FROM tags_options'; $result2 = mysql_query($query2); if (!$result){ echo mysql_error(); } while ($row2 = mysql_fetch_array($result2)) { if($row2['tag_id'] == $row['tag_desc_id'] && $row2['user_id'] == $user_info[user_id]){ //global $checked; $checked = 'checked'; echo " $checked> </input>"; } }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.