PHP - Adding Content Icon For Toggle Effect
Hello all,
Similar TutorialsThis topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=310618.0 I have installed the Carousel code using tutorial at http://www.wolf-howl.com/blogs/how-to-carousel/ now i amfacing a problem that every thing is working expect images thumbnail. here is the site http://www.digpk.com/ where i am try to make carousel. you can see the featured posts at top with missing thumbnails. Thanks in advance. picture of the problem is also attached. Hi I have website where users can upload pictures on server. Sometimes it take 4-5 seconds until the upload it's finish. What can I do that when I click on upload button an icon appear in middle of the screen and disappear then the pictures was finish uploading. Thanks I've been browsing the foams for a while now but haven't posted until now. Anyway, I have a table containing a list of items, I want a column to have either a red or a green icon depending on the state I set manually. My question is, how would I best set this up? I'd like to be able to have a simple checkbox admin page that when saved the other page reflects the state either 0 (inactive) or 1 (active), what would be the best way of storing these values and then reading them again? By this I mean a text file, MySQL, etc. I have some knowledge of PHP and MySQL, though not a massive amount. Hi is it possible to make the Icon for my input activate the date picker (I'm using Materialize for my class) A lot of users seem to instinctively try to click the icon rather than the input field on mobile devices <div class="input-field col s12 m8 l7 xl7"> <i class="material-icons prefix">calendar_today</i> <input type="text" name="r_date" class="datepicker"> <label for="r_date"></label> </div> <script> $(document).ready(function(){ $('.sidenav').sidenav(); $('select').formSelect(); $('.datepicker').datepicker({ format:'yyyy-mm-dd' }); $(".dropdown-trigger").dropdown(); }); </script>
Hi. I am looking for a way to have a button that toggles the background colour of my website. So for instance, I will have one button called 'switch to light', when its clicked it switches the colour of the background to a light colour, and another button replaces this that says 'switch to dark', and so on. I have turned to PHP because it appears to be the only way I would be able to have the change saved throughout the site, when pages are refreshed. However, I am a complete newbie, so have no idea what to do! Anyone that can help is a life saver! Thanks I'm trying to show my data under the toggle button according to the order_id. But i do not know why when i click on my toggle button it does not work. I do not know what is wrong with it. Any advice will be appreciated. <?php $dsql = "SELECT o.order_id , o.purchase_price , o.order_datetime, u.id, u.user_fullname , p.id, p.product_title , c.id , c.category, s.id , s.seller_fullname FROM ordered_items o INNER JOIN users u ON o.user_id = u.id INNER JOIN sellers s ON o.seller_id = s.id INNER JOIN products p ON o.product_id = p.id CROSS JOIN category c ON p.product_category = c.id WHERE category = '".$category."' ORDER BY o.order_id DESC"; $dquery = $conn->query($dsql); $tot_orders = mysqli_num_rows($dquery); if (!mysqli_num_rows($dquery)) { echo ' <div class="col-12"> <div class="badge badge-danger">No Orders Found</div> </div> '; } else { while ($drow = $dquery->fetch_assoc()) { ?> <tr> <td> #<?php echo $drow['order_id']; ?> </td> <td> <?php echo $drow['user_fullname']; ?> </td> <td> RM<?php echo number_format($drow['purchase_price'],2); ?> </td> <td class="text-center"> <a style="text-decoration: none;color: #000;" title="View Details" data-toggle="collapse" data-target="#products-details<?php echo $drow['order_id']; ?>"> <i class="nc-icon nc-minimal-down" onclick="changeToggleIcon(this)"></i> </a> </td> </td> </tr> <?php $p_sql = "SELECT o.order_id , o.purchase_price , o.order_datetime , o.quantity , o.quantity_unit, u.id, u.user_fullname , p.id, p.product_title , p.product_photo , c.id , c.category, s.id , s.seller_fullname FROM ordered_items o INNER JOIN users u ON o.user_id = u.id INNER JOIN sellers s ON o.seller_id = s.id INNER JOIN products p ON o.product_id = p.id CROSS JOIN category c ON p.product_category = c.id WHERE category = '".$category."'" ; $p_query = $conn->query($p_sql); while ($p_row = $p_query->fetch_assoc()) { ?> <tr class="collapse" id="products-details<?php echo $drow['order_id']; ?>" > <td style="border-top: none; font-size: 10px;"> <img src="https://dev.gopasar.today/images/product-main/<?php echo $p_row['product_photo']; ?>" style="height: 50px; width: 50px;"> </td> <th style="border-top: none; font-size: 10px;"> <?php echo $p_row['product_title']; ?> </th> <th style="border-top: none; font-size: 10px;"> Order Quantity :<?php echo $p_row['quantity']; ?><?php echo $p_row['quantity_unit']; ?> </th> <th style="border-top: none; font-size: 10px;"> RM <?php echo $p_row['purchase_price'];?> </th> </tr> </div> </div> </div> <?php } } } ?>
Hi All, I have a page where people can enter the name of food, like you would order in a restaurant (would appear on the menu). They can set if the food is gluten free, nut free, vegan etc. I am wanting to use buttons that can be clicked going red if they are not gluten free or not vegetarian and green if they are vegan or vegetarian. I have working code that does this but i dont feel like i am being efficient with how i am writing it as it is turning into a lot of repeated code. I would appreciate some help pointing me in the right direction. function popManageMenuModal($conn, $miid){ $stmt = $conn -> prepare(' SELECT menu_item_name, menu_item_is_vegan, menu_item_is_vegitarian, menu_item_is_gf, menu_item_is_nf, menu_item_is_df FROM ssm_menu_items WHERE menu_item_id = ? '); $stmt -> bind_param('i', $miid); $stmt -> execute(); $stmt -> bind_result($miname, $miisvegan, $miisveg, $miisgf, $miisnf, $miisdf); $stmt -> fetch(); if($miisvegan == '1'){ $vegansel = 'btn-success'; $vegan = 'Vegan'; $veganop = 'Is'; }else{ $vegansel = 'btn-danger'; $vegan = 'Vegan'; $veganop = 'Not'; } if($miisveg == '1'){ $vegsel = 'btn-success'; $vegi = 'Vegi'; $vegop = 'Is'; }else{ $vegsel = 'btn-danger'; $vegi = 'Vegi'; $vegop = 'Not'; } $output = ""; $output .= "<form><div class='form-group'><label>Menu Item Name</label><textarea class='form-control'>$miname</textarea></div>"; $output .= "<div class='form-inline'>"; $output .= "<div class='drButton btn $vegansel' data-value='$miisvegan'>{$veganop} {$vegan}</div>"; $output .= "<div class='drButton btn $vegsel' data-value='$miisveg'>{$vegop} {$vegi}</div>"; $output .= "<div>$miisvegan, $miisveg, $miisgf, $miisnf, $miisdf</div>"; $output .= "</form>"; return $output; } $(document).on('click','.drButton', function(){ var polarity = $(this).data("value") if(polarity == '0'){ $(this).addClass("btn-success") $(this).removeClass("btn-danger") $(this).data("value", '1') return } if (polarity == '1'){ $(this).addClass("btn-danger") $(this).removeClass("btn-success") $(this).data("value", '0') return } });
This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=348953.0 Hi, I will start off trying to explain what I am trying to make the best I can. What I want to create is a script that gets the gold value from this website: http://www.lbma.org.uk/pages/index.cfm?page_id=46&title=current_statistics and then save it to a variable which I will use to calculate values of different gold karats. Here is the content in bold I need on the website I linked: Quote LONDON GOLD FIXING USD GBP EUR AM 1588.00 1005.127 1251.083 PM 1589.50 1004.741 1249.803 So what help do I need? Well, I don't expect you to figure out the calculating part for me but some help how to get that content pointed out above and save it to a variable is what I would appreciate getting some help with. I don't know much PHP, only some and I have been trying to figure this out for a day now without any success. I suppose php get contents and/or curl should be used here but I don't know how really. I would very much appreciate the help I can get on this. Thank you! There are two effects that I have seen on website and keep wondering how they have been achieved. The first is when you go on Facebook and you type a link into your status bar. Then Facebook will automatically get some information about that article. The second effect is something I have seen on twitter and other websites. If you scroll down to the bottom of the page it will detect this and then load more content. If anyone could link me to any article or tutorials explain how these effects have been done that would be great. Thanks for any help. How do I do I prevent a broken image icon if there is no image? Here is my code: Code: [Select] <?php if ($_POST){ $county = $_POST['county']; } $con = mysql_connect("localhost","",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("", $con); $imageLocation = $row['imageurl1']; $result = mysql_query("SELECT * FROM places WHERE `county` = '".mysql_real_escape_string($county)."' order by `date_created` DESC"); if ( mysql_num_rows($result) > 0 ) { echo "<strong>Click Headers to Sort</strong>"; echo "<table border='0' align='center' bgcolor='#999969' cellpadding='3' bordercolor='#000000' table class='sortable' table id='results'> <tr> <th> Title </th> <th> Borough </th> <th> Town </th> <th> Phone </th> <th> Rooms </th> <th> Bath </th> <th> Fees </th> <th> Rent </th> <th> Image </th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr> <td bgcolor='#FFFFFF' style='color: #000' align='center'> <a href='classified/places/index.php?id=".$row['id']."'>" . $row['title'] . "</a></td> <td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['county'] . "</td> <td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['town'] . "</td> <td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['phone'] . "</td> <td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['rooms'] . "</td> <td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['bath'] . "</td> <td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['feeornofee'] . "</td> <td bgcolor='#FFFFFF' style='color: #000' align='center'>" . $row['rent'] . "</td> <td bgcolor='#FFFFFF' style='color: #000' align='center'><img src=user/". $row['imageurl1'] ." width='50'></td> </tr>"; } echo "</table>"; print_r($apts); } else { echo "<p> </p><p> </p> No Results <br /><p> </p><FORM><INPUT TYPE='button' VALUE='Go Back' onClick='history.go(-1);return true;'></FORM> and Refine Your Search <p> </p><p> </p>"; } ?> Thanks in advance Okay, Earlier on I asked someone if they could show me a shorter way of making letters one higher, Like A becomes B and B becomes C in a string. I was wondering if using this code: for($i=0, $n=strlen($text); $i<$n; ++$i) { $val = ord($text[$i]); if(($val>=65 && $val<=90) || ($val>=97 && $val<=122)) { $base = ($val<=90) ? 65 : 97; $text[$i] = chr($base + ($val-$base+1)%26); } } I could reverse it's effect and make A become Z and B become A in a string. Thanks in advance! Why do I get the following results (specifically the second example)? I thought it would be documented under https://www.php.net/manual/en/language.types.string.php, however, the word "ampersand" doesn't appear. Also, looked at logical operators, but found nothing. Thanks function test(string $string){ printf('%s %s %s 0'.PHP_EOL, gettype($string), $string, $string==0?'==':'!='); } test('123'); test('@123'); test('1@23'); test('123@');Quote
string 123 != 0
This topic has been moved to CSS Help. http://www.phpfreaks.com/forums/index.php?topic=359215.0 Hi, I have this script which does what it is meant to do. I have assigned session_id() to the variable $sid so I can use it when logging in to a users account, however I get this error. How do I get around this? Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0 As this is going to be installed on many servers, I do not want to have to edit the php.ini file on each one so as not to get this error. Is there an alternative way to assign the session_id() as so $sid = session_id(); so this doesnt happen? Code: [Select] <div id="pageNav"> <div id="sectionLinks"> <a href="admin.php?cmd=manage1&username=admin">Manage</a> <a href="admin.php?cmd=dashboard&username=admin">Dashboard</a> <a href="admin.php?cmd=msgcenter&username=admin">Message Center </a> <a href="admin.php?cmd=manage&username=logins">Logins</a> </div> </div> <div id="content"> <div class="page"> <table width="100%" border="1" align="center"> <td bgcolor="#99FF66"><div align="center"><span class="style3">Login</span></div></td> <td bgcolor="#99FF66"><div align="center"><span class="style3">Name</span></div></td> <td bgcolor="#99FF66"><div align="center"><span class="style3">Registration Date </span></div></td> <td bgcolor="#99FF66"><div align="center"><span class="style3">Approved </span></div></td> <td bgcolor="#99FF66"><div align="center"><span class="style3">Reset Password </span></div></td> <td bgcolor="#99FF66"><div align="center"><span class="style3">Delete</span></div></td> </tr> <?php session_start(); $sid = session_id(); session_register('sid'); include_once("data/mysql.php"); $mysqlPassword = (base64_decode($mysqlpword)); $db = mysql_connect("$localhost", "$mysqlusername", "$mysqlPassword") or die ("Error connecting to database"); mysql_select_db("$dbname", $db) or die ("An error occured when connecting to database"); $result = mysql_query("SELECT * FROM members"); while($row = mysql_fetch_assoc($result)){ echo "<tr><td><a href=templates/members/home.php?username=".$row['username']."&sid=$sid>".$row['username']."</a></td> <td>".$row['firstname']." ".$row['lastname']."</td> <td>".$row['registration_date']."</td> <td><a href=admin.php?cmd=approval&username=".$row['username']."&approved=".$row['approved'].">".$row['approved']."</a></td> <td><a href=templates/members/changepw.php?username=".$row['username']."&sid=$sid>Change Password</a></td> <td><a href=templates/members/delete.php?username=".$row['username']."&sid=$sid>Delete</a></td></tr>"; } ?> </div> </div> </div> <tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table> </div> </div> </div> Many Thanks Paul I want to link to a movie but I'd like to create an onrollover slideshow effect so that when the image that links to the movie is mouseover, it slowly slideshows each of the 4 images that I specify. This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=357878.0 |