Jump to content


Popular Content

Showing most liked content since 04/23/2017 in all areas

  1. 2 points
    Included files must have <?php ?> blocks around the code.
  2. 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.
  3. 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>
  4. 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.
  5. 1 point
  6. 1 point
    No, that adds a new item to the array. The new item is an array with 1 item in it, "trackPageView". So, if _paq was an empty array, then _paq[0][0] would be "trackPageView". trackPageView is a value, not a key. Those are both values, not keys. That is an array with 2 values being added to _paq. Values listed in an array are separated by commas. Technically, Javascript does not have arrays with string keys, all array keys are numeric. But since everything in Javascript is technically an object, even an array, then you can represent an array as an object structure where the property names are strings. You can refer to those using either array or object syntax. No, that's getting the first script tag on the page, so it assumes there's at least one. getElementsByTagName returns a collection of elements, so it's getting the first element in that collection. Later it uses that script element as the reference to insert the new one. It would look like this: <script type="text/javascript" async="true" defer="true" src="value_of_variable_u/piwik.js"></script> Note that the entire function expression needs to be wrapped in parentheses: (function expression)();
  7. 1 point
    This selector only targets the first direct children element/s of a parent element, not including any hierarchical child element/s of the first direct child element/s within it.
  8. 1 point
    I'm not asking you to look at the error console. Look at the network tab. It will have a whole lot of information in it whether or not the request failed. It has the HTTP method, the HTTP status code, the request headers, the request body, the response headers and the response body and it even provides information as to how long the request took to send, process and return from the server. Please show all the information that the network tab provides about the request. I've attached an image showing you what the network tab should look like in your browser:
  9. 1 point
    No, utf-8 is not a valid ISO language code, it's not a language at all. It's a character encoding. But only telling the browser which character encoding to use is not enough either, you need to actually use that character encoding. If you have some web page that you saved using a Windows Latin encoding and you're telling the browser that it's UTF-8, things aren't going to be displayed correctly. I don't know if I would make the assumption that every modern browser on every platform implements all 1,112,064 valid UTF-8 code points. You only need to find one browser not implementing one character to make that entire assumption false. I try to avoid absolute statements like that, especially when they're only assumptions. According to the MDN documentation, that is not valid.
  10. 1 point
    I'm the CTO for a small company that makes online learning courses and software.
  11. 1 point
    My solution is to use click/touch instead of hover. Keep in mind also that hover doesn't work on mobile devices, the browser doesn't know when you're just pointing at something.
  12. 1 point
    Have you checked to see what the contents of the dataString variable look like? var dataString = JSON.stringify(name,email,mobile); I don't think it translates into the POST variables you're expecting.
  13. 1 point
    Try this $.ajax({ url: 'newsletter_filler.php', data: {name: 'personal', length: 200}, dataType: 'JSON', statusCode: { 404: function() { alert("Page not found"); }}, success: function(jsonData) { console.log(jsonData); $.getScript('wordcount.js').done(function() { setWordConstraint(jsonData.personal['id'], jsonData.personal['length']); }); } }); The done() make sure script has completed, I don't know why used each function, as it will only loop through one set of json associated index row data? unless you plan to expand on this where multiple row of data will be read.
  14. 1 point
    The real_escape_string() function is not needed for prepared statements, in fact it will probably add unnecessary backslashes which make the query not return the expected results.
  15. 1 point
    You can't use array_merge with $_GET['letter_no'] because it's not an array. The array_merge function combines two arrays. If you want to add a scalar value to your array, you would do so the regular way: $_SESSION['key'] = $value array_merge() does not change either of the source arrays, instead it returns a completely new array based on the inputs.
  16. 1 point
    That expression copies the data from $_GET to the session. It has drawback of overwriting all the rest of the data you may have had in the session previously. Instead, you can create a session variable just for the GET data. $_SESSION['parameters'] = $_GET; If you're doing a query with the GET data and want the query result on multiple pages then it would be far more efficient to store the query results in the session instead of the GET parameters.
  17. 1 point
    The following SQL statement is in error $sql = "INSERT INTO users (fname, lname, uname, email, pwd, ) VALUES ('$fname', '$lname', '$uname', '$email' '$pwd')"; You have a comma after the variable name pwd that does not belong, and you left out the necessary comma between the two variable values $email and $pwd. Roddy
  18. 1 point
    No! it highlights error caused by missing '{' saying unexpected elseif, and suggest possible syntax error with preceding error '{'. which turns out to be correct, so working way down I found '}' embedded in comment.
  19. 1 point
    You can't do that! As Cascading in Cascading Style Sheet (css) means it cascades down from parent to children or sibling to below sibling elements. it never goes up. Only with JS can that be done; The space between ':hover .text' means the element with class 'text' must be within element div with class 'buttonbottom' to cascade down to .buttonbottom:hover .text{display: none;} You can place these above .text element, adding padding-bottom:, and position: relative; to bottom of box class element to allow space for these elements, then add position: absolute; and bottom: property to these bottom buttons. this will position them to where they are now, even though they are above .test class element. Then use .buttonbottom:hover ~ .text{display: none;}
  20. 1 point
    If you want to create classes for everything that's great, I was focused on trying to get you to separate everything in the first place. A reasonable class structure is probably the best option in nearly every situation, so if you're comfortable with that then do it. You can create, for example, a podcast class with everything you need to do with them, a podcast factory class for creating or getting individual or lists of podcasts, etc. About the code, the first thing I would do is move some of those things out into a generic include file for every page. Things like error reporting settings, database connectivity settings, and other things that are not for specific pages should go into a single include file. The point being that you only have 1 place to make changes if you need to adjust any of those. You don't want to go searching through a bunch of files if your database password changed. It looks like you need a newsletter class. Another principle of good design is that you generally want functions to do one thing. I think that function in particular would be better if it returned all of the data instead of sent everything to the browser (although it looks like you're mostly printing things just to see what's going on), because you may have a place where you want to get newsletter data but not send it to a browser. So it should return the data instead of using echo, and then whatever called the function can either load a template to print it to the browser, or maybe load an email template, or whatever else. If you broke that function above up into a class for a newsletter, it looks like some of the methods might be things like getQA, getNextPreview, getPodcasts, etc. Maybe the getPodcasts method would return an array of podcast objects that correspond with the newsletter. You would also have get/set methods for each of the database fields or other properties that make up the object (getId, getTitle, getAbstract, etc).
  21. 1 point
    I wasn't referring to the for loop, I was talking about the variable definition. The error message says you are using a tuple, and like it points out tuples do not have an insert method (you misspelled that in the error message). If that's true, then it sounds like you've defined the variable using parentheses instead of square brackets, which is why I was asking if that is the actual code you are executing or if you copied and pasted that code from another source.
  22. 1 point
    Use inline elements inside the paragraph, like <span> instead of <div>.
  23. 1 point
    I'm don't know how your entire website is structured. Are you using a content management system? Whichever system you're using, it should provide a way to modify content in the head of the page. The browser should only see one <head> element per document, otherwise your HTML is invalid. If you want to add a stylesheet after an AJAX call, you can generate it using Javascript. Have the server return the URL of the stylesheet and have Javascript use the URL to generate a <link> tag. // Assuming AJAX returned a JSON object in the data variable if(data.stylesheet) { var link = document.createElement("link"); link.rel = "stylesheet"; link.href = data.stylesheet; document.getElementsByTagName("head")[0].appendChild(link); }
  24. 1 point
  25. 1 point
    CSS can't put gradients on text. Perhaps you can make your gradients more subtle so that the text isn't hard to read on it.
  26. 1 point
    If $(this).attr('id') returns the correct ID, then this (and the jQuery-wrapped $(this)) refer to the same element. There's no reason to get the ID from the element, then get the element again. You already have it, you're getting the ID from it.
  27. 1 point
    You could also use $(this) to refer to each element, instead of getting the ID of $(this) and then looking up the same element.
  28. 1 point
    1) Anything using below class will use pointing finger cursor .style1 { font-family: Verdana; font-size: 10pt; text-align:justify; cursor:pointer; } 2) You said Which means you would have to apply this styling class name to container element, which would either be a Paragraph, or Anchor, or Strong element that surround the text ' Click to Read More'. BUT! you have applied class name to This is outside the scope of what you are trying to target, its scope starts from opening span <span class="style1"> and finishes at </span>, all the text "W3Schools is a popular web site for learning web technologies online.[2] Content includes tutorials and references relating to..." will have the pointer cursor, but anything outside this will work as default styling, which is what is happening to anchor text you are attempting to target, because its outside '<span class="style1">....</span>' scope.
  29. 1 point
    You have to build it or hire somebody to build it for you. A PHP script will work if your server supports PHP, but there are tons of other server-side languages with which to build your website.
  30. 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 } ?>
  31. 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.
  32. 1 point
    That's because you set it to false right before you alert it. Go back and look at the code I posted, notice how the variable definitions are outside the load handler. They first get defined with those default values, maybe at some point later down the page PHP will redefine them, and then once the page finishes loading the rest of the Javascript runs, using either the default values or the values that were set by PHP.
  33. 1 point
    The idea of a foreign key is that the database would not allow you to enter a non-existent order_number in your cust_time table. It would only accept order_numbers that already exist in the customer table.
  34. 1 point
    The second parameter indicates the size of the subsets to search for, not the size of the initial set. The expected output is wrong. The people who provided the exercise mentioned it here: http://www.w3resource.com/javascript-exercises/javascript-function-exercise-21.php#comment-3039932910 The output should only have subsets with two elements.
  35. 1 point
    Send it as GET querystring with customer number edituser.php?cust_id=n where 'n' will be the customer number.
  36. 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
  37. 1 point
    Which IP address? (localhost) or the ip address of network o/s hosting the web site? check out https://stackoverflow.com/questions/9682262/how-do-i-connect-to-this-localhost-from-another-computer-on-the-same-network
  38. 1 point
    You need to add the second parameter when you call currentDiv, like you did with plusDivs. In order for the function to highlight the correct dot, each of those dot elements needs to specify which slide show it belongs to, so that showDivs can get the correct set of dots. One way would be to add a class name or data attribute to the dot container elements, or to the dot elements themselves.
  39. 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.
  40. 1 point
    You have a program written in what? It seems to me that this is either an Android Java question or an iOS Swift question. Or is it Javascript that was loaded from a website which it has now lost connectivity to? Which is it?
  41. 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
  42. 1 point
    That refers to a constant. It would be defined in the Feed class as const ATOM = 'Some value'
  43. 1 point
    Open your browser's developer tools and go to the Network tab, refresh the page and look for any failed requests to see what's missing.
  44. 1 point
    There is no action attribute in the following line of code <form id="form" method="post"> You must enter an URL for ajax_comment.php as the value of your action attribute in the above <form> element. <form id="form" method="post" action='pathto/ajax_comment.php'> Replace the word "pathto" with whatever is necessary to connect the document that contains your form with the document that processes your $_POST variable -- namely, ajax_comment.php.
  45. 1 point
    <form method="post" name="form_name" id="form_name" action="https://www.w3schools.com/comment.php"> <fieldset> <legend>Title</legend> <p>A brief explanation about what you would like to see entered.</p> <textarea name="comment" form="form_name" maxlength='400' rows="8" placeholder='Character Limit: 400'></textarea> </fieldset> <input type="submit" value="Submit comment"> </form> In addition you must decide what you want to do with the comments and how to process them one they are received via the post ($_POST) method at comment.php. Roddy
  46. 1 point
    Like I mentioned in the other thread where the original question got removed, that is markup from versioning control software that is showing the differences between two versions of a file. You downloaded the diff instead of the source code.
  47. 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
  48. 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", ""); } }
  49. 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>'; ?>
  50. 1 point
    It is a nice way to interact with GitHub, but it isnt a GUI for just using Git. Still, very useful since sometimes its hard to remember the commands for pushing to GitHub like "git push origin master"