Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by Shadowing

  1. my query is running off of a SESSION that gets changed according to what is selected. So I guess the only way i can make this work is if the page reads the planet from the link instead of using Session then? that makes sense since java script is read after php. I have some thinking to do then, not sure i want to use $_GET for this.
  2. thanks for the reply redsmurph in this case it changes the planet a person is viewing. queries some information and sets it as a Session so when selection changes $planets3 = "SELECT address FROM planets WHERE name ='".mysql_real_escape_string($_POST['siege_list'])."'"; $planets2 = mysql_query($planets3) or die(mysql_error()); $planets1 = mysql_fetch_array($planets2); $_SESSION['planet'] = $planet1['address']; so i dont know how to make java script fire the php code
  3. Hey guys I wasnt sure if this is a php topic or java script im trying to make my drop down menu's activate onchange. what confuses me is how do I make php know that the java script is being run. Or have the java script trip my php code. To know a button has been pressed i use "if (isset['_POST'])" echo '<select name="siege_list" id="siege_list">'; foreach($name as $key => $value) { echo '<option value="' . $value['name'] . '" ' . ($value['name'] == $current1 ['name'] ? 'selected="selected"' : '') . '> ' . $value['name'] . '</options>'; } echo '</select><input type="submit" id="siege_planet" onchange="this.form.submit()">';
  4. thank you thorpe. whats a better way of doing it? or maybe something i can read. Id like to have better technique. one thing i hate is when i started learning all this stuff that i started out building on poor foundations on how im writing.
  5. I notice if I try to hit enter and split a long string up with java script i get a error. onmouseover="popup('<img src="images/planets/<?php echo $picture; ?>.jpg"/> <?php echo planet_pop_up($detail_name,$stargate_address,$detail_owner); ?>');"> then i have a function being inserted into the code above "planet_pop_up" the function has this string in it. $details = "<h4>$detail_name</h4><br /><br /><br /><p>Owner: $detail_owner</p>"; This string is going to get really long cause im going to be adding to it. If i try to bring some of it onto a new line i get a java script error. "Unterminated string constant" like this below $details = "<h4>$detail_name</h4><br /><br /><br /> <p>Owner: $detail_owner</p>"; anyone know what I need to do to to so i can use more then one line lol.
  6. On most website messaging systems when you hit reply on a message it takes you to the compose screen with the reply message auto filled in. Im using a Session to achieved this. My question is how do they make it so each line of the reply has arrows like this > message >> so it seperates the reply from what the person is about to type This has me clueless
  7. after massive research lol I solved my problem with <?php // deletes code for check boxes if(isset($_POST['delete'])) { // only if a box is checked if (!empty($_POST['association'])) { // loops through and grabs the sent_id of each box that is checked foreach($_POST['association'] AS $sent_id => $val) { $sent_id = (int) $val; // deletes the message related to the sent_id of the check box mysql_query('DELETE FROM `sent` WHERE `sent_id`= ' . (int) $sent_id); header("Location: sent.php?sent=1"); } } } ?>
  8. im completly stuck on this. I have extinguished all ideas
  9. Alright tested this out and its deleting only one at a time and doesnt even delete the one I clicked on lol its deleting the very last one so if i have 2 pages of rows it deletes the very last one on the 2nd pagination page. so im doing something wrong here
  10. thanks for responding kicken im reading tizag.com implode tutor lol I think im starting to understand this please let me know if im getting this idk can i just shove $glue in the query like that thats the whole point in impoloding right to beable to put it all into a single variable? <?php if(isset($_POST['delete'])) { $pieces = array("$sent_id"); // is that how i grab them? $glue = implode("-", $pieces); foreach ($_POST['association'] as $sent_id){ mysql_query("DELETE FROM `sent` WHERE `sent_id`= '".mysql_real_escape_string($glue)."'"); } } >?
  11. I really need some huge help on deleting rows with check boxes. Im completly lost on how to do this. Read some examples online and even with the code being small to do this i cant figure it out on intergrading it with the code I wrote. sorry that the code is long on this. I have decent comments though. At the very bottom i have started writing the delete code. My problem is figuring out how to make the script know what check box is checked. I have a select all check box java script on this page too <form name="frm1" id="frm1" action="" method="post" 15.onsubmit="javascript:return submitIt('frm1')"> <p> <center> <table width="60%" border="1" cellspacing="1" cellpadding="0"> <tr align="center"> </tr> <tr align="center"> <td><input type="checkbox" name="checkAll" value="x" id="checkall" onclick="checkUncheckAll('association[]', this.checked)" /></td> <td>Recipient</td> <td>Subject</td> <td>Sent</td> <td>read/unread</td> </tr> <?php // find out how many rows are in the table $count3 = "SELECT COUNT(*) FROM sent WHERE id = '".($_SESSION['user_id'])."'";; $count2 = mysql_query($count3) or trigger_error("SQL", E_USER_ERROR); $r = mysql_fetch_row($count2); $numrows = $r[0]; // number of rows to show per page $rowsperpage = 10; // find out total pages $totalpages = ceil($numrows / $rowsperpage); // get the current page or set a default if (isset($_GET['sent']) && is_numeric($_GET['sent'])) { // cast var as int $currentpage = (int) $_GET['sent']; } else { // default page num $currentpage = 1; }// end if // if current page is greater than total pages... if ($currentpage > $totalpages) { // set current page to last page $currentpage = $totalpages; }// end if // if current page is less than first page... if ($currentpage < 1) { // set current page to first page $currentpage = 1; } // end if // the offset of the list, based on current page $offset = ($currentpage - 1) * $rowsperpage; // get the info from the db $count3 = "SELECT * FROM sent WHERE id = '".($_SESSION['user_id'])."' ORDER BY time DESC LIMIT $offset, $rowsperpage "; $count2 = mysql_query($count3) or trigger_error("SQL", E_USER_ERROR); // while there are rows to be fetched... while ($list = mysql_fetch_assoc($count2)) { // these are variables to place in the echo $sent_id = $list['sent_id']; $recipient = $list['sendto']; $subject = $list['subject']; $read = $list['read']; // grabs the time offset $take3 = "SELECT time_offset FROM users WHERE id='".mysql_real_escape_string($_SESSION['user_id'])."'"; $take2 = mysql_query($take3) or die(mysql_error()); $take1 = mysql_fetch_array($take2); $recieved = $list['time']; // adds the users time offset to the inputed time $time = ($recieved + $take1['time_offset']); // sets default time to UTC then formats the inputed time that was offset with the users offset date_default_timezone_set('UTC'); $user_offset = date('h:i:s a M/d', $time); ?> <tr> <td><center><input type="checkbox" name="association[]" id="<?php echo $sent_id; ?>" value="1" /></center></td> </label></td> <td><center><a href="search_goaulds.php?goauld=<?php echo $recipient; ?>"><?php echo $recipient ?></a></center></td> <td><center><a href="sent_view.php?sent_id=<?php echo $sent_id; ?>"><?php echo $subject ?></a></center></td> <td><center><?php echo $read ?></center></td> <td><center><?php echo $user_offset ?></center></td> </tr> <?php } // while loop ?> </table> </center> <div class="deletecontainer"> <div class="delete"> <br/> <input type="submit" name="delete" id="delete" value="Delete"></p> </form> </div> </div> <?php if(isset($_POST['delete'])) { // if checkbox is checked with the matching sent_id if(isset($_POST['sent_id'])) { // then delete sent_id matching the checkbox id mysql_query("DELETE FROM `sent` WHERE `sent_id`= '".($_POST['sent_id'])."'"); } } ?>
  • 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.