PHP - Close Collapse Menu On Link Click
Hello,
I am using this collapse menu from bootstrap:
http://getbootstrap....cript/#collapse
What I did is instead of putting text in the content section I added many links. The links only show up when one of the menu link is clicked.
Now my problem is that in one of the menu sub, there are about 30 links, therefore the user has to go down the page to see the content.
Is there a way to have the menu collapsing on itself when a link is clicked please? Like a reset to reset it like on page load
Thanks all,
Ben
Similar Tutorialshey there peoples i have a bit of a problem with my php code. when i click on the name it wont play the video. but if i click on the thumbnail it plays here is the code Code: [Select] echo "<div class='Video_thumbnail'>"; echo "<a href='/Video.php?id={$row['id']}'>"; echo "<img src='http://i.ytimg.com/vi/{$row['link']}/hqdefault.jpg' width='220' height='170' alt='click' /></a>"; echo "<br>"; echo "</br>"; echo "<a href='/Video.php?={$row['id']}'>"; echo "{$row['navn']}</a>"; echo "</div>"; i have this simple table browse get me the filter let say 15 items of a table of 74 but after i click in the link forward the filter erase and disply me the all records... waht im doing wrong.... TNX in advance <img src="images/misc/search.JPG" width="367" height="100" /> <br /> <?php $strng = $_POST['search:strng']; $separa = "%"; $all = $separa.$strng.$separa; $mensaj="U Look for : "; $mensaj2=$mensaj.$stng; $regis=" u search get :"; $regis2=" Items"; $conn = mysql_connect('localhost','zerocctv_Admin','password') or trigger_error("almacen", E_USER_ERROR); $db = mysql_select_db('zerocctv_almacen',$conn) or trigger_error("almacenz", E_USER_ERROR); $sql = "SELECT COUNT(*) FROM modelos where descrip like '$all'"; $result = mysql_query($sql, $conn) or trigger_error("SQL", E_USER_ERROR); $r = mysql_fetch_row($result); $numrows = $r[0]; $rowsperpage = 10; $totalpages = ceil($numrows / $rowsperpage); // get the current page or set a default if (isset($_GET['currentpage']) && is_numeric($_GET['currentpage'])) { $currentpage = (int) $_GET['currentpage']; } else { $currentpage = 1; } if ($currentpage > $totalpages) { $currentpage = $totalpages; } if ($currentpage < 1) { $currentpage = 1; } $offset = ($currentpage - 1) * $rowsperpage; $sql = "SELECT modelo, paginal,precio,foto FROM modelos where descrip like '$all' LIMIT $offset, $rowsperpage"; $result = mysql_query($sql, $conn) or trigger_error("SQLkk2", E_USER_ERROR); echo $Mensaj2 ; echo $regis. $numrows . $regis2 ; echo "<table width=\50%\ border=\1\ bordercolor=\#0033FF\ cellspacing=\1\">" ; while ($list = mysql_fetch_assoc($result)) { echo "<tr>"; echo "<td>><font color='red'>" . $list['model'] . "</font></td>"; echo "<td><font color='black'>" . $list['pagl'] . "</font></td>"; echo "<td><font color='black'>" . $list['prize'] . "</font></td>"; echo "<td><font color='black'>" . $list['pict'] . "</font></td>"; echo "<tr></tr>"; echo "</tr>"; } echo "</table>"; //****** build the pagination links ******/ $range = 3; if ($currentpage > 1) { echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=1'><<</a> "; $prevpage = $currentpage - 1; echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$prevpage'><</a> "; } for ($x = ($currentpage - $range); $x < (($currentpage + $range) + 1); $x++) { if (($x > 0) && ($x <= $totalpages)) { if ($x == $currentpage) { echo " [<b>$x</b>] "; } else { echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$x'>$x</a> "; } } } if ($currentpage != $totalpages) { $nextpage = $currentpage + 1; echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$nextpage'>></a> "; echo " <a href='{$_SERVER['PHP_SELF']}?currentpage=$totalpages'>>></a> "; } ?> Every other time a user/users click on a link I want the link to change to a different url the next time a user clicks onto that link.
For example two links
url1.html
url2.html
url1.html shows up when a user clicks that link the link auto changes to then when a new user clicks the linke url2.html then back to url1.html and so on?
Don't know where to start on how I would do this let alone have the server remember to keep which ever link to be held for the next user?
how can i do this pls? i just want to display a link "Free Chat" when i click on it, it must display a dropdown with options "yes" and "no" the link must not go anywhere yet, only when yes is selected it must go to a page i have the code: Code: [Select] <a href="" id="link" name="link" onClick="yesnolist(1)">Free Chat</a> then i have javascript: Code: [Select] <script type="text/JavaScript"> function yesnolist() { var e = document.getElementById("link"); var strUser1 = e.options[e.selectedIndex].value; if (strUser1 == "1") { window.location.href = "http://........."; } return strUser1; } </script> the above is not correct, can some-one help me please? thanks Folks, When someone click on a link on my webpage and if that Link takes the visitor off my site, then i want to make an entry in my database. But if that link goes back to some other link in my Site then i do not want to Count that link. So, is there any code that lets me detect any outgoing link Click? Cheers I am having problems understanding the reason for why the user has to click logout twice, here's the bulk of the code: <?php ini_set('display_errors',0); require_once 'header.html'; require_once 'db.functions.php'; require_once 'config.php'; $database = dbConnect($host, $username, $password, $database); // should output 1 or nothing at all! if($database == true) { // now connected? // carry on with logic of outputting the blog contents: $result = entries("SELECT * FROM entries"); printf("<table>"); while($row = mysql_fetch_array($result)) { printf(" <tr> <td>%s</td> <td>%s</td> </tr> <tr> <td colspan=\"2\">%s</td> </tr> ", $row[2], $row[4], $row[3]); } printf("</table>"); printf("\n\n"); session_name("jeremysmith_blog"); session_start(); if(array_key_exists('login',$_SESSION)) { if($_SESSION['login'] == 1) // change this to correspond with session on the login.php script { printf("<p>Welcome %s</p> <p>To logout, click <a href=\"index.php?action=logout\">here</a></p> ",$_SESSION['username']); } } else { printf("<p>You are not logged in, please click <a href=\"login.php\">here</a> to login.</p>"); } } else { printf("\n<p id=\"error\">Could not connect to database, please try again later.</p>"); } // init the logout script? if(array_key_exists('action',$_GET)) { if($_GET['action'] == 'logout') { // log user out of the system: unset($_SESSION['login']); unset($_SESSION['username']); session_destroy(); } } printf("\n"); // just for output format! require_once 'footer.html'; Why does the user have to click logout twice, have I missed anything? Any helps appreciated thanks. Hello All
From the begin i have the following code.
<?php $sql = "SELECT id,phonemodel FROM iphone"; $rows = $conn->sqlExec($sql); $nr_row = $conn->num_rows; $meniu ='<ul>'; if($nr_row>=0) { foreach($rows as $row) { $meniu .= '<li><a href="iphone.php?id='.$row['id'].'">'.$row['phonemodel'].'</a></li>'; } } $meniu .= '</ul>'; echo $meniu; if(isset($_GET['id'])) { $id = (int)$_GET['id']; $sql = "SELECT * FROM iphone WHERE id = $id"; $rows = $conn->sqlExec($sql); $nr_rows = $conn->num_rows; if($nr_rows>0) { foreach($rows as $row){ echo 'Name Tel: '.$row["phonemodel"].' Title : '.$row["titlereparation"].' Pret : '.$row["price"].' Message : '.$row["msj"].' ID : '.$row["id"].'<br />'; } } else { echo '0 Results'; } } ?>Basicaly i have a website for phone repairs.And i want to create in iphone.php a menu from DB and when i acces the menu with _GET variable, when i press Iphone 5s (iphone.php?id=id page) the code have to display to me,all reparations for iphone 5s. Until now,i succssed to create the Menu but the code keep add same line in the menu when i add for example a second reparation for 5s.And i don't know how to select all reparation for 5s and display them in a single link like above Iphone 5s (iphone.php?id=id page). Now the script working like this.Create a menu with all phone names. Iphone 5s Iphone 3 Iphone 3s Iphone 4 Iphone 5s Iphone 5s Shoud be like Iphone 5s Iphone 3 Iphone 3s Iphone 4 Other new devices.. And display the reparation in every link from list By ID.i try it to select by phone names,not working. Any body with any ideea please? Thx so much Im working with the animatedcollapse.js file which collapses divs. I need to collapse divs with the id's 1,2,3,4. Simple enough. However they wont always be 1,2,3,4 as these are the ids (forum_id) pulled from the database. the animatedcollapse.js script requires the names of the divs to be entered like so: <a href=\"javascript:animatedcollapse.show(['1','2','3','4'])\"> but like i said it won't always be 1,2,3,4 so how can i pull the id's and add them to that href? i was thinking an array but ive never worked with them before so i cant get it to work. I need to pull all of the forum_id's where parent_id = 1 and then add the id's to the href. Is this necessary? mysql_close($link); $query = "SELECT * FROM db_one WHERE field1 = '".$MyVar."'"; $results = mysql_query($query); while($line = mysql_fetch_array($results)) { echo $line["a"].",,"; echo $line["b"].",,"; echo $line["c"].",,"; echo $line["d"].",,"; echo $line["e"].",,"; echo $line["f"].",,"; echo $line["g"].",,"; echo $line["h"].",,"; echo $line["i"].",,"; echo $line["j"].",,"; echo $line["k"].",,"; echo $line["l"].",,"; } mysql_close($link); Hi,
Ive been trying to come up with a simple solution.
I run a scheduled task every 1 minute, it checks for a certain message in a MySQL DB.
If the message is there then i need to access a link such as:
https://www.somedoma...00000&body=This is the SMS to be sent&plaintext=1
This essentially sends an SMS to a user.
both the recipient and the body need to be a variable.
Is there a way then to get PHP to load/run the link without actually opening a browser?
ive been trying to check out allow_url_fopen but i cant seem to find any examples of how this works.
Any info or pointers would be great thanks.
I am trying to create a login menu where senior salesman get redirected to one page and salesman get redirected to another. Trying to figure out my game map. Here is what's going on: Any player can view themself on the map and also the user at this location: x:50, y50. For some reason the map will not show anyone else. If you would like to see it, just go to http://www.gglegends.net/map.php and login with the credentials below (only 1 user can be logged in at a time): Credential for Demo Account - (I have restricted areas that affect others gameplay and areas that change the demo account) Username: demo Password: pass Other map locations to try out: x:60, y:60 x:19, y:79 x:98, y:72 x:75, y:51 x:97, y:26 x:66, y:12 Here is the complete code to my map: <?php require 'includes/header.php'; //Check to see if user exists in the map table, if not redirect location to get coordinates $user_map_check_results = $db->query ("SELECT * FROM map WHERE uID=".$user['uID'].""); $user_map_check = mysql_num_rows($user_map_check_results); if ($user_map_check == 0){ echo '<META HTTP-EQUIV="Refresh" Content="0; URL=firstrun.php">'; die(); } //Fetch the largest x coordinate in the map table. $map_size_x_result = $db->query( "SELECT MAX(x) AS map_max_x FROM map" ); $map_size_x = $db->fetch( $map_size_x_result ); //Fetch the largest y coordinate in the map table. $map_size_y_result = $db->query( "SELECT MAX(y) AS map_max_y FROM map" ); $map_size_y = $db->fetch( $map_size_y_result ); //Set map size. Determined by largest x and y coordinates. $grid_x = (int)$map_size_x['map_max_x']; $grid_y = (int)$map_size_y['map_max_y']; //x and y rows to display at a time. $display_rows = (int)10; //Fetch all user locations. $users_map_result = $db->query( "SELECT * FROM map LEFT JOIN users ON map.uID=users.uID" ); $users_map = $db->fetch( $users_map_result ); //Fetch user map location from database. $user_location_result = $db->query( "SELECT * FROM map LEFT JOIN users ON map.uID=users.uID WHERE map.uID=".$user['uID']."" ); $user_location = $db->fetch( $user_location_result ); //default display coordinate if none specified - will be user map location. $x = (int)$user_location['x']; $y = (int)$user_location['y']; $param_x = $_REQUEST["xcord"]; $param_y = $_REQUEST["ycord"]; if (isset($param_x) && isset($param_y)) { //validate that the parameter is a legit point. if (($param_x <= $grid_x) && ($param_x >= 1) && ($param_y <= $grid_y) &&($param_y >= 1)) { $x = (int)$param_x; $y = (int)$param_y; } } //set map location to the center of the map. $display_half = round($display_rows / 2); $other_half = $display_rows - $display_half; //display the target in the middle. $start_x = ($x - $display_half) +1; $end_x = $x + $other_half; //if the $start_x variable is less than 1 the grid would be in the negatives. so set it to 1. if ($start_x < 1) { $start_x = 1; $end_x = $display_rows; } else //if $end_x is off the grid we have to compensate and add the remaining rows to the start. if ($end_x > $grid_x) { $extra = $end_x - $grid_x; $end_x = $grid_x; $start_x = $start_x - $extra; } //same applies for the y axis. $start_y = ($y - $display_half) +1; $end_y = $y + $other_half; //if the $start_y variable is less than 1 the grid would be in the negatives. so set it to 1. if ($start_y < 1) { $start_y = 1; $end_y = $display_rows; } else //if $end_y is off the grid we have to compensate and add the remaining rows to the start. if ($end_y > $grid_y) { $extra = $end_y - $grid_y; $end_y = $grid_y; $start_y = $start_y - $extra; } ?> <b><tl>World Map</tl></b><br /> <img alt="" src="images/seperator.gif" /><br /> Click anywhere on the map to begin moving around. You can click on players name's to view their profile.<br /><br /> Move to Map Location or <a href="map.php"><u>Return to base</u></a>. <?php echo "Current Map Coordinates: X $x - Y $y"; ?><br /> <!-- Search custom coordinates --> <form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="GET"> <input name="xcord" type="text" size="3" maxlength="2" onblur="if ( this.value == '' ) this.value = this.defaultValue" onfocus="if ( this.value == this.defaultValue ) this.value = ''" value="x"> <input name="ycord" type="text" size="3" maxlength="2" onblur="if ( this.value == '' ) this.value = this.defaultValue" onfocus="if ( this.value == this.defaultValue ) this.value = ''" value="y"> <input type="submit" value="Submit"> </form> <br /><br /> <!-- Show map --> <table width="750" cellspacing="0" cellpadding="1" border="0"> <?php //these 2 for loops represent the y and x axis //using the data collected above the loops will properly display the grid. for ($Ty = $start_y; $Ty <= $end_y; $Ty++) { //start new row echo '<tr>'; for ($Tx = $start_x; $Tx <= $end_x; $Tx++) { //show grid DisplayGrid($Tx,$Ty); } echo '</tr>'; } ?> </table> <?php //Function to disaply the map. function DisplayGrid($grid_x,$grid_y) { global $x, $y, $user_location, $users_map; $bgimg = 'grass.gif'; $building = ''; if ($grid_x == $user_location['x'] && $grid_y == $user_location['y']) { $building = '<img src="images/map/building.gif" alt="" border="0" /><br />'; $user_map_name = '<br /><a href="player_profile.php?id='.$user_location['uID'].'" target="_blank"><u><b>'.$user_location['uLogin'].'</b></u></a><br />'; } if ($grid_x == $users_map['x'] && $grid_y == $users_map['y']) { $building = '<img src="images/map/building.gif" alt="" border="0" /><br />'; $user_map_name = '<br /><a href="player_profile.php?id='.$users_map['uID'].'" target="_blank"><u><b>'.$users_map['uLogin'].'</b></u></a><br />'; } echo "<td width=\"75\" height=\"75\" style=\"background-image: url('images/map/$bgimg');background-repeat: repeat;\" align=center valign=center onclick=\"window.location.href='map.php?xcord=$grid_x&ycord=$grid_y'\">$building $user_map_name</td>"; } require 'includes/footer.php'; ?> I have a problem, where i need to know when user leave or close tha browser tab. I tryd to make a ajax post, after unload, make a POST into kill_browser.php and after 1 minute when session_expire, php code will be execute and save time into database. But it not seems to work :/ I'm glad if some 1 can say what im doing wrong, or is there eny better way to detect it.
@home.php
var leaved = 'leaved'; $(window).unload( function(){ $.ajax({ url: 'kill_browser.php', global: false, type: 'POST', data: leaved, async: false, success: function() { console.log('leaved'); } }); }); @kill_browser.php <?php require('class/connection.php'); $conn = new connection(); session_cache_limiter('private'); $cache_limiter = session_cache_limiter(); session_cache_expire(1); $cache_expire = session_cache_expire(); session_start(); $_SESSION['leaved'] = $_POST['leaved']; if($_SESSION['leaved'] == null || $_SESSION['leaved'] == " "){ $conn->logOut($_SESSION['userID'], $_SESSION['userIP'], $_SESSION['LAST_GENERATED_ID']); session_regenerate_id(true); unset($_SESSION); session_destroy(); header('location:index.php'); } ?> Hello, I'm having a bit of trouble with the following: <?php echo htmlentities('<img src="<?php bloginfo('template_directory');?>/images/my-image.png" / rel="nofollow">'); ?> As you can see, I am trying to use php to call the template directory but it isn't being recognized as a php statement. I'm new to php and I'm pretty certain my syntax is not right. Can someone provide a bit of guidance? Thank you. Quint Hey there, I currently have a banning system on my site that doesn't allow users to login with the banned account. But the cookies are set to remember them for a year. How can I destroy their cookie, so that they don't stay logged in and continue to use the site? Hi there, I was wondering if it is possible to (on the closing of a browser to a logged in user) to automatically destroy that session. Thanks in advance. hope i'm in the right place. Hello,my name is carlton. i have a html form i created in dreamweaver cs. i have the accompanying .php script to forward user details to the server. i fill in the form, hit the submit button and nothing appears in the table i created. the testing server has been successfully configured the database "babiesnmovies" is recognized by dreamweaver. PLS tell me what i'm missing. below is a copy of the form and the script. Thank you so much. //this is the HTML registration web form i created in dreamweaver// Code: [Select] <legend>Parents Contact Information</legend> </h3> <form id="form1" name="form1" method="PUT" action="babiesnmovies.php"> <p> <label for="babiesnmovies.com/register">Your First Name</label> <input type="text" name="yourfirstname" id="babiesnmovies.com/register" /> <label for="babiesnmovies.com/registered">Your Last Name</label> <input type="text" name="yourlastname" id="babiesnmovies.com/registered" /> </p> <label for="babiesnmovies.com/yourname">Your Phone Number</label> <input type="text" name="yourphonenumber" id="babiesnmovies.com/yourname" /> <label for="babiesnmovies.com/email">Your E-mail</label> <input type="text" name="youremail" id="babiesnmovies.com/email" /> </p> </form> <p> </p> <h3> <legend>Baby's Vitals</legend> </h3> <form id="form2" name="form2" method="PUT" action="babiesnmovies.php"> <p> <label for="babiesnmovies.com/baby'slast">Baby's First Name</label> <input type="text" name="babysfirstname" id="babiesnmovies.com/baby'sfirst" /> <label for="babiesnmovies.com/babies">Baby's Middle Name</label> <input type="text" name="babysmiddlename" id="babiesnmovies.com/babies" /> </p> <p> <label for="babyslastname">Baby's Last Name</label> <input type="text" name="babyslastname" id="babyslastname" /> </p> <p> <label for="babiesnmovies.com/babybday">Baby's Birthdate</label> <input type="text" name="babysbirthdate" id="babiesnmovies.com/babybday" /> <label for="babiesnmovies.com/babyage">Baby's Age</label> <input type="text" name="babysage" id="babiesnmovies.com/babyage" /> </p> <p> <label for="babiesnmovies.com/baby">Baby's Height</label> <input type="text" name="babysheight" id="babiesnmovies.com/baby" /> <label for="babiesnmovies.com/babyweight">Baby's Weight</label> <input type="text" name="babysweight" id="babiesnmovies.com/babyweight" /> </p> <p> <label for="babiesnmovies.com/babyeyes">Baby's Eye Color</label> <input type="text" name="babyseyecolor" id="babiesnmovies.com/babyeyes" /> <label for="babiesnmovies.com/babyhair">Baby's Hair Color</label> <input type="text" name="babyshaircolor" id="babiesnmovies.com/babyhair" /> </p> <p> <label for="babiesnmovies.com/babyrace">Baby's Ethnicity</label> <input type="text" name="babysethnicity" id="babiesnmovies.com/babyrace" /> </p> <p><input name="formsubmit" type="submit" value="Submit" /> </form> //this is the babiesnmovies.php script// <?php # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" $hostname_babiesnmovies = "XXX"; $database_babiesnmovies = "XXX"; $username_babiesnmovies = "XXX"; $password_babiesnmovies = "XXX"; $babiesnmovies = mysql_pconnect($hostname_babiesnmovies, $username_babiesnmovies, $password_babiesnmovies) or trigger_error(mysql_error(),E_USER_ERROR); mysql_select_db("db337879506", $con); $sql="INSERT INTO register (id, YourFirstName, YourLastName, YourPhoneNumber, YourEmailAddress, BabysFirstName, BabysMiddleName, BabysLastName, BabysBirthdate, BabysAge, BabysHeight, BabysWeight, BabysEyeColor, BabysHairColor, BabysEthnicity) values ( 'NULL','$yourfirstname', '$yourlastname', '$yourphonenumber', 'youremailaddress', '$babysfirstname', '$babysmiddlename', '$babyslastname', '$babysbirthdate', '$babysage', '$babysheight', '$babysweight', '$babyseyecolor', '$babyshaircolor', '$babysethnicity')"; $yourfirstname = $_POST ['YourFirstName']; $yourlastname = $_POST ['YourLastName']; $yourphonenumber = $_POST ['YourPhoneNumber']; $youremailaddress = $_POST ['YourE-mailAddress']; $babysfirstname = $_POST ['BabysFirstName']; $babysmiddlename = $_POST ['BabysMiddleName']; $babyslastname = $_POST ['BabysLastName']; $babysbirthdate = $_POST ['BabysBirthdate']; $babysage = $_POST ['BabysAge']; $babysheight = $_POST ['BabysHeight']; $babysweight = $_POST ['BabysWeight']; $babyseyecolor = $_POST ['BabysEyeColor']; $babyshaircolor = $_POST ['BabysHairColor']; $babysethicity = $_POST ['Babys Ethnicity']; ?> Thank you. I have a script there download a lot of images from a website it crawls, but when ever i started a crawler, it will keep downloading images. Even if i close firefox, it will continue to download images from the site. How can i stop it?. hi, im trying to parse this xml file : xml.gamebookers.com/sport /football.xml_attr.xml i want to echo on my page like this : league name 1 match 1 of league 1 odds odds odds match 2 of league 1 odds odds odds . . league name 2 match 1 of league 2 odds odds odds match2 of league 2 odds odds odds . . this is my code so far <?php $xml=simplexml_load_file('http://xml.gamebookers.com/sports/football.xml_attr.xml'); $league=$xml->xpath('//event/..'); // leagues refers to element<group> $matches=$xml->xpath('//bettype[@name="Versus (with Draw)"]/..'); // shows matches name (team versus team) $odds=$xml->xpath('//event/bettype[@name="Versus (with Draw)"]/bet'); //odds of matches 1 x 2 $leaguecount=count($league); $matchescount=count($matches); $oddscount=count($odds); $i=0; while ($i<$leaguecount){ echo $league[$i]['name'].'<br>'; $i++; } echo '<br><br>'; $i=0; while ($i<$matchescount){ echo $matches[$i]['name'].'<br>'; $i++; } $i=0; while ($i<$oddscount){ echo $odds[$i]['odd'].'<br>'; $i++; } ?> it prints this: http://www.mh724.com/school/xp.php so i need something like that: echo league[$i][mathces[$i][odds[$i] // like arrays of array but it does not work of course any help will highly appreciated :shrug: with regardS Hi guys, This is very important. The supervisor of my system wants to close accounts which contain zero balances for long time periods. There is a separate page contains ID and Account Number.This is included in a form and a "close account" button is there. When he clicks on that button the relevant record should be deleted from all tables which include that ID. The table structure looks like this. There are 4 account types which contain same fields. savings_investment(ID,account_type,full_name_balance,interest,customer_id) I want full coding of this scenario. Thanks, Heshan |