Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation since 05/25/2017 in all areas

  1. 2 points
    There's nothing formal to tell you things like that. People do it themselves, and it tends to illustrate the Dunning-Kruger effect. People who just recently started tend to rate themselves highly, and only when you get more into something do you realize how much you don't know. I wouldn't put any weight on things like that. If you want to evaluate someone's capabilities look for a portfolio or things they've actually finished.
  2. 2 points
    You had wrongly referenced a JavaScript function, and wrongly named a css selector so very important position: relative was not applied. <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> * {box-sizing:border-box} body {font-family: Verdana,sans-serif;margin:0} .mySlides {display:none; width: 100%;} /* Slideshow container */ .slideshow { /*NOT slideshow-container*/ max-width: 1000px; position: relative; margin: auto; } /* Next & previous buttons */ .prev, .next { cursor: pointer; position: absolute; top: 50%; width: auto; padding: 16px; margin-top: -22px; color: white; font-weight: bold; font-size: 18px; transition: 0.6s ease; border-radius: 0 3px 3px 0; } /* Position the "next button" to the right */ .next { right: 0; border-radius: 3px 0 0 3px; } /* On hover, add a black background color with a little bit see-through */ .prev:hover, .next:hover { background-color: rgba(0,0,0,0.8); } /* Caption text */ .text { color: #f2f2f2; font-size: 15px; padding: 8px 12px; position: absolute; bottom: 8px; width: 100%; text-align: center; } /* Number text (1/3 etc) */ .numbertext { color: #f2f2f2; font-size: 12px; padding: 8px 12px; position: absolute; top: 0; } /* The dots/bullets/indicators */ .dot { cursor:pointer; height: 13px; width: 13px; margin: 0 2px; background-color: #bbb; border-radius: 50%; display: inline-block; transition: background-color 0.6s ease; } .active, .dot:hover { background-color: #f44336; } /* Fading animation */ .fade { -webkit-animation-name: fade; -webkit-animation-duration: 1.5s; animation-name: fade; animation-duration: 1.5s; } @-webkit-keyframes fade { from {opacity: .4} to {opacity: 1} } @keyframes fade { from {opacity: .4} to {opacity: 1} } /* On smaller screens, decrease text size */ @media only screen and (max-width: 300px) { .prev, .next,.text {font-size: 11px} } </style> </head> <body> <div id="wrapper"> <div class="slideshow w3-container w3-half"> <div class="w3-content w3-display-container"> <img class="mySlides fade" src="https://www.w3schools.com/howto/img_nature_wide.jpg"> <img class="mySlides fade" src="https://www.w3schools.com/howto/img_fjords_wide.jpg"> <a class="prev" onclick="plusDivs(-1, 0)">&#10094;</a> <a class="next" onclick="plusDivs(1, 0)">&#10095;</a> <!-- Extra plusDivs parameter refers to first (0) slideshow (start from 0) --> </div> <br> <div style="text-align:center"> <span class="dot" onclick="currentDiv(1, 0)"></span> <span class="dot" onclick="currentDiv(2, 0)"></span> </div> </div> <hr> <div class="slideshow w3-container w3-half"> <div class="w3-content w3-display-container"> <img class="mySlides fade" src="https://www.w3schools.com/howto/img_nature_wide.jpg"> <img class="mySlides fade" src="https://www.w3schools.com/howto/img_fjords_wide.jpg"> <a class="prev" onclick="plusDivs(-1, 1)">&#10094;</a> <a class="next" onclick="plusDivs(1, 1)">&#10095;</a> <!-- Extra plusDivs parameter refers to second (1) slideshow (start from 0) --> </div> <br> <div style="text-align:center"> <span class="dot" onclick="currentDiv(1, 1)"></span> <span class="dot" onclick="currentDiv(2, 1)"></span> </div> </div> <script> var slideIndex = 1; var z = document.getElementsByClassName("slideshow"); for (i = 0; i < z.length; i++) { //set custom data attribute to first current image index z[i].setAttribute("data-currentslide", 1); showDivs(z[i].getAttribute("data-currentslide"), i); } function plusDivs(n, j) { //get custom data attribute value of current image index to slideshow class index j slideIndex = parseInt(z[j].getAttribute("data-currentslide")[0]); showDivs(slideIndex += n, j); } function currentDiv(n, j) { showDivs(slideIndex = n, j); /* showDivs Not showSlides*/ } function showDivs(n, j) { var i; var z = document.getElementsByClassName("slideshow")[j]; var x = z.getElementsByClassName("mySlides"); var dots = z.getElementsByClassName("dot"); if (n > x.length) { slideIndex = 1 } if (n < 1) { slideIndex = x.length; } //set custom data attribute to current image index z.setAttribute("data-currentslide", slideIndex); for (i = 0; i < x.length; i++) { x[i].style.display = "none"; } for (i = 0; i < dots.length; i++) { dots[i].className = dots[i].className.replace(" active", ""); } x[slideIndex - 1].style.display = "block"; dots[slideIndex - 1].className += " active"; } </script> </div> </body> </html>
  3. 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.
  4. 1 point
    According to the documentation for the ajax method, beforeSend is called before the request is even sent. The 2 parameters that the function gets passed are the jQuery XHR object, and the settings object. So in your code, podType is set to the jQuery XHR object. The beforeSend function is really for modifying the request before it goes out (or canceling it), so I would think your code for changing the page should all go in the success function. Inside that success function podType will still have the value it had when you send the request, unless you change the value inside the function. You also need to quote all of those values in your case statements, otherwise you're trying to compare the value with different variables.
  5. 1 point
    The reason why your code isn't working is because $con is not defined in those functions (and $pass and $conf_pass are not defined in newUser either). You can use global variables inside the function, but it's better to avoid globals and pass in any variables you want the functions to use. So you should pass $con to the functions. You should add this to the top of your code: ini_set('display_errors', 1); error_reporting(E_ALL); You should switch your database code to use prepared statements instead of trying to manually escape everything. Prepared statements offer better security. You can use prepared statements with mysqli, but it's better to use PDO. The PDO code is shorter and easier to understand, and PDO works with databases other than only MySQL. e.g.: $stmt = $pdo->prepare("SELECT * FROM users WHERE username = ?"); if ($stmt->execute(array($username))) { if ($row = $stmt->fetch()) { // it found a user } } http://php.net/manual/en/book.pdo.php For the code I posted above, I was saying that each function should only do one thing. Your newUser function should only validate and add the user if necessary, it should not also output anything or redirect. Your main code should do that based on what the function returned. If you want to return multiple values you can use an array like I did above to return a "success" value for whether the user was added, and a message to show them. So your main code would call that function and then decide what to do. Those header redirects wouldn't work though, because you sent output to the browser first. $result = newUser(...); if ($result['success']) { // maybe redirect to a thank-you page or something } else { // show the error in $result['message'] }
  6. 1 point
    What does that mean? How are you opening it? Are you just double-clicking on a file on your computer or something? If so, the PHP code won't run at all. Or, if it's actually on a web server, then there's always a request. The server responds to requests, that's its job.
  7. 1 point
    The problem with using echo statements is that code editors will not highlight the HTML syntax. If you're building a template file, you usually have large amounts of HTML with small amounts of PHP. I personally do not like the BASIC style syntax even for templates. When you use curly braces, most code editors will show you where the current brace ends and allow you to show or hide the block of code. With proper formatting and indentation the code becomes easier to read. <?php if(isset($_GET['edit'])) { ?> <button type="submit" name="update">update</button> <?php } else { ?> <button type="submit" name="save">save</button> <?php } ?>
  8. 1 point
    It doesn't have a plain reading. You use that question mark because it is a query string. From https://www.freeformatter.com/url-parser-query-string-splitter.html What's the 'query string' in a URL? The query contains extra information that is usually in the key-pair format. Each pair is usually separated by an ampersand & character. It follows the ? character. Examples: http://www.foo.bar/image.jpg?height=150&width=100 https://www.secured.com:443/resource.html?id=6e8bc430-9c3a-11d9-9669-0800200c9a66#some-heade
  9. 1 point
    Unfortunately this site has no connection with the administrators of w3shools.com, posting this error here, won't receive any attention to fix this error, but I suggest you go to 'About' page on W3schools.com then at bottom of page, click report error link.
  10. 1 point
    I remember when blink was phased out, Mozilla made a big announcement out of it. It used to work in all browsers, but was deprecated and later removed.
  11. 1 point
    There isn't really any support for using a phone's fingerprint scanner through a browser. Most applications that use fingerprint authentication will connect to a fingerprint reader attached to the server or another network device.
  12. 1 point
    The length is 3. The indexes go from 0 to 2. That is 3 elements, which is why the length is 3. 0, 1, 2 -> that's 3 elements.
  13. 1 point
    echo '<form method="post" action="findorder.php?order_num=' . $order_num . '"><input type="submit" name="testing" value="Edit" /></form>'; Will work with $this_order = $_GET['order_num']; //would retrieve value of $order_num $this_test = $_POST['testing']; // would retrieve value of 'Edit'. echo $this_order . '<br>' . $this_test; IF get method the input will overwrite the querystring set in action, if you wish to use GET method you would have to do it this way echo '<td><form method="get" action="findorder.php"><input type="hidden" name="order_num" value="'$order_num.'" ><input type="submit" name="testing" value="Edit" /></form></td>'; with $this_order = $_GET['order_num']; //would retrieve value of $order_num $this_test = $_GET['testing']; // would retrieve value of 'Edit'. echo $this_order . '<br>' . $this_test; IF going this way it would be better to set form AS POST method, so the naming and values do not appear in address bar of browser
  14. 1 point
    Actually No, there are several ways to do this, and I did not which had been chosen, but the how the querystring and value are used is the important part to get it to work.
  15. 1 point
    dsonesuk is referring to using <a> tag. Like: <a href="edituser.php?cust_id=n">Edit User</a>
  16. 1 point
    Yes! you can easily reformat the date format from database to whatever you want, with whatever separators you want on output using echo, see https://www.w3schools.com/php/showphp.asp?filename=demo_func_date_format https://www.w3schools.com/php/php_date.asp Its just a matter of swapping YY and DD on desired string format parameter
  17. 1 point
    div>p {background-color: yellow;} Will set paragraphs that's a direct child element of parent element div with background yellow https://www.w3schools.com/cssref/tryit.asp?filename=trycss_sel_element_gt it won't change paragraphs nested within other child elements of the div parent. div p {background-color: yellow;} will change ALL child paragraphs within parent div whether they are nested or not. :root will target the <html> element, it being the outermost containing element (root) * universal selector: meaning target ALL elements. : single colon used for pseudo classes such as :hover, :link, : visited :: used for pseudo element ::after, ::before used to create content before or after a elements content, NOTE: older IE browsers use the single colon, but both can be used for modern better browsers than IE and Edge.
  18. 1 point
    Try using w3css modal, with w3-animate-left class with w3-modal-content class https://www.w3schools.com/code/tryit.asp?filename=FHE8DTJR3F2P working solution https://www.w3schools.com/code/tryit.asp?filename=FHE95QEVR6BC
  19. 1 point
    That refers to a constant. It would be defined in the Feed class as const ATOM = 'Some value'
  20. 1 point
    I'm not sure what code you're using to get the mouse offset, but once you have it you can calculate the correct position by dividing the canvas real size by its visible size. // Assuming we already have a reference to canvas and the mouse's position // relative to it is in visibleX and visibleY var horizontalRatio = canvas.width / canvas.offsetWidth; var verticalRatio = canvas.height / canvas.offserHeight; var realX = horizontalRatio * visibleX; var realY = verticalRatio * visibleY; // Do something with realX and realY
  21. 1 point
    There are several problems with that upload code. The major one is that you are doing no error checking or validation on the file that was uploaded. If someone uses that form to upload a .php file, you'll just copy it to your server where someone can then access the URL, and now you're running some random PHP code that someone uploaded. That's probably the single easiest way to get your server hacked. You need to validate the file to make sure that it's allowed, and you also need to check for errors that may have happened during the upload: http://php.net/manual/en/features.file-upload.errors.php You also need to use prepared statements when you're sending data to the database. Don't put variables right into the query, use a prepared statement with placeholders that you can use to send the data separately to protect your database. The mysqli extension supports prepared statements: http://php.net/manual/en/mysqli.quickstart.prepared-statements.php To avoid re-submitting the form when someone refreshes the browser, after you finish processing the form you should send a location header to redirect the user. Then if they refresh they will only refresh the redirected URL instead of the form submission. You can redirect them to a thank you page, some other page that shows a message from the form, back to the form, etc. You should also move all of your form processing code to the top of your file, before any HTML output. If you're just going to end up redirecting the user there's no reason to send any HTML at all. The first thing the file should do is figure out if it needs to process or display the form, and go from there. For some reason you used an embed tag, you only need to use a video tag. Look up the video reference to see how to use that. You also messed up with the quotes in that string, if you view the source code of that page in the browser you'll see the problem.
  22. 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".
  23. 1 point
    <?php $book = array( "Language" => array("English", "Franch", "Arabic"), "Programming" => array("PHP", "JAVA", "C++"), "Science" => array("Physics", "Geography", "Math"), ); $classRef = ""; $keysvalues = array_keys($book); echo '<ul>'; for ($i = 0; $i < sizeof($book); $i++) { $classRef = str_replace(" ", "_", strtolower($keysvalues [$i])); echo '<li class="' . $classRef . '">' . $keysvalues [$i]; echo '<ul>'; foreach ($book[$keysvalues [$i]] as $value) { echo '<li>' . $value . "</li>"; } echo '</ul>'; echo "</li>"; } echo '</ul>'; ?>
  24. 1 point
    It's possible using data URLs as the src attribute of the <img> element: https://developer.mozilla.org/en-US/docs/Web/HTTP/data_URIs I don't recommend it because older versions of Internet Explorer wouldn't support it and because it could really slow down the page loading depending on how large the images are. Normally, the page continues loading while requests for images are being processed but by using Data URLs, the image has to be fully loaded before loading the next element in the page. Also, base64 encoding increases the size of the image by 33%. Just include the PHP files in the src attribute of the <img> elements.
  25. 1 point
    A lot of questions asked here in this forum can be answered simply by reading the tutorials, and most often what people are asking are actually examples in the w3school main website. Some questions are even extremely similar, but yet people ask the same questions all over again.That "please-read-the-tutorial-first" message pinned at every forum apparently DOES NOT work.I firmly believe that this forum is created to answer questions that the w3schools main website does not answer.I do not have a solution for this. But this would just serve as a precaution. Because basically when this forum grows. Then a lot new topics will be started.Then probably, we will be reading a bunch of repetitive questions being asked all over and over and over again.And please forum members, please dont post for the sake of increasing your post count. Post for the sake of answering questions being asked.And if you wish to promote your website here, we cant/wont stop you with it, but please do it in an ETHICAL way. There is no excuse for not having any manners/ethics.And lastly, this forum, in my humble opinion, is used for answering questions (or some code snippets) not for asking for full/complete scripts.This is just my opinion. You might think i'm wrong, but really i think i am right with this one. You just have to agree with me here.
×