Jump to content


Popular Content

Showing most liked content since 06/26/2013 in all areas

  1. 2 points
    I don't know where there's a list. Generally you should never develop for specific devices, you should just make your layout flexible enough (with help of media queries) to wotk on any screen regardless of size. This is usually achieved by testing your page in the responsive mode of your browser and resizing the viewport until it breaks, then you add a media query to correct the layout. But for reference, I start off with a design for the following devices, then make extra adjustments later: Small mobile (iPhone 4):Up to 374px (I usually use this just for specific elements that didn't fit) Mobile or small mobile in landscape): Up to 767px Tablet portrait: 768px Tablet landscape: 1024px (breakpoint usually between 800px and 900px) Desktop: 1025px and above Some people make designs for large desktop computers (1440px and above), but that's up to you. In general, there isn't one specific strategy for responsive design, this is just the approach from the companies I work with.
  2. 2 points
    Like astralaaron said using closest class and the index class in jquery you can get the index of the tr, have a look at the fiddle. https://jsfiddle.net/8hL46ftj/ hope this helps $('img').click(function(){ alert($(this).closest('tr').index()) })
  3. 1 point
    The act of adding the new HTML content (it does not matter that the content came from somewhere on the page) causes the browser to execute whatever Javascript is in there. The Javascript that is in there tells it to replace the HTML content again, and that keeps happening until the browser gives up. The position of the PHP code is not relevant as far as the browser is concerned, the position of the Javascript code is relevant. Don't put the Javascript code to do the replacement inside the HTML that gets added, it needs to go outside of the element that you're copying. Now, if you need to change the PHP code to get the Javascript code to show up somewhere else, then do what you need to do. I would expect that you only have to change something inside the template though. It's always better to produce the final version the first time, instead of spending time to produce an intermediate version which then needs to spend more time to produce the final version. Redrawing the page in the browser is a fairly expensive process (relatively speaking), it's best to limit how many times you're telling the browser to draw the page. Browsers have gotten a lot better at that over the last decade, but it's still a good practice to try to just produce the final page the first time. That's just how the browser handles it. The HTML on that page is not valid, there's not much point trying to figure out how or why the browser is going to handle invalid HTML when you should just produce valid markup. The first link causes the Javascript loop and error in the console. That link only shows up when clicking from the other page, right? Why do you use a hash, what's the point? If you have the podcast ID shouldn't that be enough to uniquely identify it?
  4. 1 point
    You are prompting for input within the scope of function to x variable, while calling the function with argument outside the scope of function. It will never be able to know the variable x equals.
  5. 1 point
    Use a separate field in the table to specify the sort order, and when you insert the data make the sort order field whatever order you want to retrieve the data.
  6. 1 point
    If you're specifically talking about sending a location header to redirect the user, I just don't understand the technical need for that. I don't see any problem which gets resolved by redirecting the user to another page, I don't understand why you think that's a solution to any problem you think you have. They're already on your site, PHP can do anything you want it to do, I don't understand why you've come to the conclusion that the thing you want PHP to do is to just redirect the user and start PHP over again. It's already running, just do what you need it to do the first time. It almost seems like you've learned a few things about PHP, you have a solution, and now you're searching for a problem for your solution. I just don't see the need to redirect, I don't see any problem that a redirection solves. The only time you need to redirect someone is if you want them on a different page for whatever reason, maybe because they've just submitted a form, you processed the form, and you don't want them to hit refresh and re-submit the form. Or they just logged in, and you're taking them to wherever they go after logging in. Those are the cases when you might redirect someone. You're describing your solution to redirect a user and I'm missing the problem you're trying to solve by doing that. Why? Why do you need to know that? If you're just interested in tracking traffic and things like that, I would suggest something like Google Analytics. Otherwise, why would any page care where the user came from, why is that relevant to what the page is supposed to produce? I'm not sure if we're experiencing a language or terminology barrier or what, but I'm having a hard time understanding why you think you have all of these requirements. A web page, or PHP page, or whatever, typically has a single purpose in terms of what it displays, and that purpose typically does not depend on where the user came from. A certain URL, in general, should always show the same content regardless of how the user got there. You wouldn't want people to share a certain URL and have it show different content for different people, that wouldn't make sense to them. You're talking about setting session variables when the user gets to the page, why? The session is for tracking who the user is, if they just got to your site you don't know anything about them, why do you think you have to use the session? It sounds like you're learning individual tools in PHP and then trying to apply everything to your site even though it's not necessary. Not every page or site needs to use every PHP function.
  7. 1 point
    Why should it hide? there is nothing there to cause it to hide.
  8. 1 point
    Like I said though, with a 1-to-1 relationship you usually put all of that in one table. It's not normal to have a primary key that is also a foreign key.
  9. 1 point
    The foreign key should be defined on the second table, not the first one. The second table has a foreign key to the parent table.
  10. 1 point
    Use string to time function strtotime(), you can multitude textual expression to get the result you want, then loop through each day by increasing by 1 in a loop // set initial start date to next sunday from current date $date = date("Y-m-d", strtotime("next Sunday")); //set from $date value to 1 week ahead for end date $end_date = date("Y-m-d", strtotime("+1 week", strtotime($date))); //'2020-12-31'; while (strtotime($date) <= strtotime($end_date)) { echo $date . "<br>"; //increment to next day $date = date("Y-m-d", strtotime("+1 day", strtotime($date))); }
  11. 1 point
    Well, my answer is still the same thing. Make sure everything, not just the database connection, is using the same encoding. I've never used that many statements to set MySQL to UTF8, you can do it with "SET names utf8". There's also a mysqli function specifically for that: http://php.net/manual/en/mysqli.set-charset.php Other than the database, make sure that your page is telling the browser that it's UTF8, that it's part of the response headers, and that the text actually is UTF8.
  12. 1 point
    w3-cell-row has additional w3-cell-row:before and w3-cell-row:after which applies content:""; with display: table, this it seems, is causing the difference.
  13. 1 point
    If you just want people to all edit the same email and send it back, that's fine, but you can't do this with nothing but an email client: If you want to add authentication and authorization, then you need to use an actual programming language and not just a text email. It would be better to centralize everything on one web page also so that you don't end up with people editing the thing at the same time and all sending it out and now you have multiple versions of the table that you need to try and synchronize. If you need a group to collaborate like that then use the right tool for the job, which is a single web page that everyone goes to so that everyone can see the same data and everyone can be authenticated and authorized to enter data in the appropriate places.
  14. 1 point
    Have you tried this? <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title> HTML5 page </title> </head> <body> <div class="form-group"> <label class="col-sm-4 control-label">Checkbox inputs</label> <div class="col-sm-8"> <div class="checkbox check-transparent"> <label for="opt01">Option 1</label> <input type="checkbox" value="1" id="opt01" checked> </div> <div class="checkbox check-transparent"> <label for="opt02">Option 2</label> <input type="checkbox" value="1" id="opt02"> </div> <div class="checkbox check-transparent"> <label for="opt03">Option 3</label> <input type="checkbox" value="1" id="opt03"> </div> </div> <div> </body> </html>
  15. 1 point
    It's the same basic theory. You need a way to detect if there is a connection, and a place to store the data until there's a connection. If it's running in a browser then you can use localstorage to store the data until you detect a connection.
  16. 1 point
    Are you sure you used enough tags for this post? If you want to know if something will work offline, it will help to know what that something is. What does it do that you don't think will work offline? If it's using server-side languages then you'll still need to have a local web server installed (or put it on a server on the network).
  17. 1 point
    You want what to happen, an anchor to get created or edited or something? Like with most things, instead of finding something that tells you exactly how to do specifically what you want to do, you need to understand the basics and the theory yourself so that you can apply that to build what you want. You can start here, but there's a lot more information online about dragging and dropping. https://www.w3schools.com/html/html5_draganddrop.asp
  18. 1 point
    Well it would using MS Paint, but using FastStone Photo Resizer, it will do multiple selected images, to a specific size proportionately, rename adding custom suffix like '_thumb', and save to alternative format, to a destination you chose.
  19. 1 point
    * Is known as wildcard symbol so if value appears anywhere within class attribute value ^ Is 'begin with', so if value appears at beginning of class attribute value. $ Is 'end with', so if value appears at end of class attribute value. https://www.w3schools.com/css/css_attribute_selectors.asp
  20. 1 point
    If sco is an ADO recordset object, you can look at the documentation for open here to figure out what the parameters are used for: https://docs.microsoft.com/en-us/sql/ado/reference/ado-api/open-method-ado-recordset You can click through to see the various options for the cursor and lock types.
  21. 1 point
    If you're going to ask the same question, then it's going to be the same answer: If you don't want to use PDO and have it throw exceptions when you make a mistake, then you need to check for errors yourself. If prepare returned false, then you need to print the error message from MySQL. You have a problem with the SQL query you're trying to prepare. You changed the format of that UPDATE query between the two pieces of code and now the query is wrong. UPDATE queries do not use the same format as INSERT queries.
  22. 1 point
    Well it would help if you place the style properties within the style attribute.
  23. 1 point
    So, why use AJAX at all? Since AJAX depends on Javascript being turned on or off, and since this decision is made by the user-client, why not use PHP whose functioning is determined solely by the host-server?
  24. 1 point
    The superglobal is like any other variable in the PHP process, it only exists during the time the script is running. If you want to store its value permanently somewhere you can use a database or write it to a file. If you want to store something for one user during a browsing session you can use PHP sessions.
  25. 1 point
    The RSS file can go anywhere you want, you just have to tell people where to find it. As I mentioned earlier, you can tell browsers where to find a feed by putting a <link> tag in your HTML page. There's no real best practice as to where to place your RSS feed files. I think RSS feeds have to use absolute URLs in the <link> tags including protocol and domain name to point to the location of the files. If you want a URL like "/feed" for your RSS feed you would have to use URL rewriting on the server, a regular URL would look like this instead: "/feed.xml" or "/feed.rss".
  26. 1 point
    PHP extension is required if you need to process data sent from form whose method is post or get using $_POST, $_GET, or $_REQUEST. IF its action is a link to another php page, then the form page can remain html, if it is sent to itself then the form page should be php.
  27. 1 point
    Where in Brazil?
  28. 1 point
    Program files is a protected directory, did you open command prompt by right clicking it and selecting 'run as administrator'.
  29. 1 point
    The form attribute only applies to form control elements. It doesn't exist on elements like <div> or <p>. What kind of element are you referring to when you say "non-form element"? This is regarding the form attribute from the MDN page for the <input> element: When the element is a descendant of a <form> element the form attribute is not needed. If the element is not inside a <form> then the form attribute will indicate which form the element belongs to so that when the form is submitted the element's value is added to the data that is sent. I'm not certain how fieldset elements behave, I would guess that the fieldset's children would belong to the same form that the fieldset belongs to, but it can be easily confirmed with an experiment. Experiments can be done with the form attribute by submitting the form and seeing which values get sent to the server. My guess before doing experiments is that a child of one form that has a form attribute from a different form will be added as a value when either of the two forms are submitted.
  30. 1 point
    You can store anything in a PHP session. https://www.w3schools.com/php/php_sessions.asp
  31. 1 point
    Here's the fix for MS kak, you would have thought they would have known better by now. // Close the dropdown if the user clicks outside of it window.onclick = function(e) { /*because of MS god complex thou shall do it how I WANT, and not how every else wants, which I thought they had finally begun to see the light, but apparently not! we have to allow for MS kak way of doing things*/ matches = e.target.matches ? e.target.matches('.dropbtn') : e.target.msMatchesSelector('.dropbtn'); if (!matches) { var myDropdown = document.getElementsByClassName("dropdown-content"); for (var i = 0; i < myDropdown.length; i++) { if (myDropdown[i].classList.contains('show')) { myDropdown[i].classList.remove('show'); } } } };
  32. 1 point
    I use Netbeans, because its not limited to just 1 or two server languages, but several, including frameworks Zend, smarty, Laravel, Java etc, It gives you traffic light indication to highlight errors in red and warnings in amber, it gives hints, in indicates what closing braces elements belong to. There is also Sublime, but I found Netbeans gives me what I want, and the ability to add more if I want.
  33. 1 point
    <?php session_start(); //start the session for the page include("../include/db.php"); //include database file include("../include/settings.php"); //include configuration file //Check if page was entered by a submit button $email=$_POST['email']; //Get username !!FROM FORM!! $email = ereg_replace(" ", "", $email); //take away all spaces from username (if any) !!FROM FORM!! $password=base64_encode($_POST['password']); //Get name !!FROMFORM!! if (empty($email) || empty($password)) { echo "Empty fields";} else{ //check to see if the username or email allready excists $ck=$flash->prepare("SELECT * FROM `user` WHERE `email`=:email AND `password`=:password "); //get rows where the username or email address is allready registered $ck->bindParam(':email',$email); $ck->bindParam(':password',$password); $ck->execute(); //if email address allready excists if($ck->rowCount() > 0){ echo "user loged in successfully"; } else{ echo "Login or password inccorect";} } ?> use that phpand keep the alert(result); it should be clear now
  34. 1 point
    BUT! you are still going through multiple id references ('fruit' and img) when only one span and one image only can have the unique id
  35. 1 point
    You can't have block element within paragraph, move opening p tag under h2 tag. It probably corrected by adding closing tag after opening tag, which means no opening tag for ending closing p tag.
  36. 1 point
    There are three aspects to take into account in a web page: Content: HTML Presentation: CSS Behavior: Javascript The same way we want to separate content from presentation, we also want to separate content from behavior. Javascript should only be inside <script> elements, CSS should only be in <style> or <link> elements and HTML should not be polluted with attributes concerning behavior and presentation. You wouldn't use align and bgcolor attributes, so why would you use onclick attributes? In your original code, otherTongue is restricted to the local scope of the function it was declared in, it's not accessible from outside. That's why the onchange event attribute can't find it, the event attribute is looking for a global function.
  37. 1 point
    var SelOrderArray=[]; $.each($selected,function(i){ //loop through selected possible multiple selected options if(SelOrderArray.indexOf($selected[i]) === -1){ //if current looped through $selected value not in array then add to array SelOrderArray.push($selected[i]); } }); // loop through ordered array of slected options $.each(SelOrderArray,function(i){ //clone element with specific id to temp storage variable var TmpDivClone = $("#"+SelOrderArray[i]).clone(); //remove current existing element with specific id $("#"+SelOrderArray[i]).remove(); // prepend temp cloned element to div #result wrapping mydiv1 elements so prepending remains below dropdown and show TmpDivClone.prependTo('#result').show(); }); Not tested, written on tablet
  38. 1 point
  39. 1 point
    Every time you create a new row you're adding another event handler to all the rows. The newest row will have just one event handler, but the older rows will have as many event handlers as times you've clicked the "new" button.
  40. 1 point
    Add 'this' to the function called by anchor link event onclick <a onclick="myAccFunc(this)" href="#">First group<i class="fa fa-caret-down"></i></a> Then you need to ref that specifically clicked element, transverse down to next sibling element and change that elements classname function myAccFunc(elem)//amended by dsonesuk { var x = elem.nextElementSibling;//amended by dsonesuk if (x.className.indexOf("w3-show") == -1) { x.className += " w3-show"; x.previousElementSibling.className += " w3-green"; } else { x.className = x.className.replace(" w3-show", ""); x.previousElementSibling.className = x.previousElementSibling.className.replace(" w3-green", ""); } }
  41. 1 point
    I don't think that it would be a bad thing personally, as a lot of popular frameworks like Angular 2 and React are using ES6 and TypeScript in their tutorials and so are a lot of the blogs and guides. That said, there will still be the requirement of needing a transpiler for the time being but, I certainly think there are lots of tutorials and guides around that too, however, at the risk of linking people off site to other tutorials (for Babel, TypeScript, Webpack, Gulp, etc) I could see W3Schools being hesitant in that regard as well. Either way, I firmly encourage any intermediate JS developer to start learning ES6 features now and consider taking the extra time to learn how to transpile that source code down to ES5 compatible JS. New features, like imports have fundamentally helped changes the language (for the better IMO) and I think the resulting source code is better for it too.