Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation since 10/19/2017 in all areas

  1. 2 points
    Included files must have <?php ?> blocks around the code.
  2. 1 point
    The rawurlencode() and encodeURIComponent() functions transform any non-ASCII values into ASCII, that's exactly what they are for. I said query string components, which refers to these sections: ?a=component1&b=component2 If you do not escape =, ? and & in those values then you will not get the values you expect in the server. The following example is a query string that will not give the desired value on the server: ?candy=M&Ms. If you do not escape the &, then the server will see a key "candy" with value "M" and another key "Ms" with no value.
  3. 1 point
    There are several ways to do this as explained here https://stackoverflow.com/questions/369602/php-delete-an-element-from-an-array?rq=1 Since you know the value/s you might as well use array_diff() <?php $pic_array = [1, 2, 3, 4, 5, 6, 7, 8, 9]; echo '<p>remove key/value, but not reseting remaining keys using array_diff()</p>'; $remove = [6]; $pic_array = array_diff($pic_array, $remove); var_dump($pic_array); echo '<p>remove multi keys/values, but not reseting remaining keys using array_diff()</p>'; $remove = [6, 2]; $pic_array = array_diff($pic_array, $remove); var_dump($pic_array); echo '<p>reseting remaining key values using array_values()</p>'; $pic_array = array_values($pic_array); var_dump($pic_array); ?>
  4. 1 point
    Also, for what it's worth, URLs do have a maximum size limit, and it's not the same across browsers. So, be careful about how much you decide to cram into a querystring. If you can use a post request instead, do so.
  5. 1 point
    <?php $stove=""; if(isset($_POST['stove'])){ $stove=$_POST['stove']; }
  6. 1 point
    The use of both async and defer is often done because old versions of Internet Explorer only understood the defer attribute. They're not mutually exclusive, async tells the browser to continue loading the rest of the page while the script is being downloaded. The defer attribute works the same, but deferred scripts are executed in the same order as they are in the DOM rather than executing each one the moment they finished downloading. The async and defer properties are explained in detail on this page: https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement In short, x.parentNode.insertBefore(y, x) means to put y right before x in the document. It doesn't matter what or where x or y are as long as they're both DOM nodes. The insertBefore method works like appendChild(), but instead of putting it at the end of the children, it specifies one of the existing children of the node before which the new element should be inserted. W3Schools has a page explaining the insertBefore() method here: https://www.w3schools.com/jsref/met_node_insertbefore.asp
  7. 1 point
    The clue is in the method name 'document.getElementById()'. None of those radio button has a id ref, and it would be impractical to use that anyway, The options are to use getElementsByName("guess") and loop through them all, identify which is checked and retrieve that elements value. function test() { var myinput = document.getElementsByName("guess"); for (i = 0; i < myinput.length; i++) { if (myinput[i].checked) { document.getElementById("answer").value = myinput[i].value; } } } OR use the newer 'document.querySelectorAll()' function test() { var myinput = document.querySelectorAll('input[name="guess"]:checked')[0]; document.getElementById("answer").value = myinput.value; }
  8. 1 point
    IF you do it correctly $("input[data-class='resultdate'"] Should be $("input[data-class='resultdate']")
  9. 1 point
    You can access the server's filesystem using a server-side programming language like PHP. If you want to access files on the user's computer you'll have to create a desktop program in a language like C++ or Java and ask the user to download and run it.
  10. 1 point
    If that code above has the click handler, I see one for podcast_link elements that isn't going to do anything. You prevent the default behavior, get some data, and that's it.
  11. 1 point
    <input type="submit" value="Enviar"> That's all you have to do.
  12. 1 point
    The styling of form elements is very restricted. You can read more about it here: https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms/Styling_HTML_forms You can't style optgroup elements. If it's very important to give style to a structure similar to that one you'll have to create your own imitation of a dropdown using Javascript.
  13. 1 point
    OR use array $pr_ar $key in foreach to apply index key ref to the newly created array item each loop $pr_ar = array(0 => 'cola', 1 => 'colb', 2 => 'colc', 3 => 'cold'); $unique = uniqid(); $suf = substr($unique, 0, 11); foreach ($pr_ar as $key => $pre) { $new_col = $pre . $suf; $cna = []; $cna[$key] = $new_col; var_dump($cna); } ?> It will give the correct result from your previous post, but why create another array? just gather the string value on each loop, and use to rewrite column name, if this is to used to change column names? as indicated by another topic.
  14. 1 point
    No, that wouldn't work. The function needs a name if you want to use it like that, and there's no guarantee that the file has been parsed yet when the callback is executed. If you want to go with the anonymous function, have it executed as soon as its declared like this: (function() { // Function content })(); // Executed immediately. // Load the external file, it runs on its own so nothing else needs to be done $.getScript('data.js'); I don't really get the point of loading a separate file containing Javascript, though. It's better to just load a script file containing all the functions when the page loads using a <script> tag and then call those functions by name whenever they're needed.
  15. 1 point
    To address your original error, note that prepare returns false if it fails: http://php.net/manual/en/mysqli-stmt.prepare.php The error message from MySQL does not get automatically printed by PHP. If you're not checking for errors and error messages then you're going to end up in a staring contest with your code until the truth reveals itself. Don't do that, just print the error message and figure out exactly why it's not working. if (!$mysqli_stmt->prepare($sql_select)) { echo $mysqli_stmt->error; } The same is true for other methods like bind_param, with the mysqli extension you need to check for errors yourself and print the messages.
  16. 1 point
    Every time the user opens a page on your website, they send cookies belonging to your domain. Aside from being the program that sends the session cookie, the browser is irrelevant to how sessions work. The browser does not know what a session is, it just sends cookies. When PHP's session_start() method is called, it uses the ID provided by the session cookie, searches for data from the specified session based on that ID and stores that data into the $_SESSION variable, which is available to you. $_SESSION is just a regular array, the only difference being that its value is retained when the user changes pages. Session restrictions are exactly the same as cookie restrictions: The session expires when the session's cookie expires The same session can be used every single PHP page from the domain that the cookie belongs to, including subdomains. Cookies have the option to be restricted to particular subdomains or even directories if necessary. You can set the cookie parameters using session_set_cookie_params().
  17. 1 point
    In the function construct, one of the parameters is the super global $_GET. After doing some testing just to be certain, you cannot re-assign values to it. This is the error I got while testing: Fatal error: Cannot re-assign auto-global variable _GET in /Applications/MAMP/htdocs/testing/classTest.php on line 12 Did you see this error? I noticed the super global $_GET earlier in the construct but dismissed/overlooked it.
  18. 1 point
    Either one will work, its used to insert a text element to help vetically align the popup content box as it need something to align to, this also uses display: inline-block so it acts as text would with text-align and vertical-align, you can change to top/bottom whatever.
  19. 1 point
    Here's a simplified example <img src="data:image/png;base64,<?php echo base64_encode(file_get_contents("../../image.jpg")) ?>" alt=""> It's base64 encoded, the original path won't be viewable, just the encoding of image.
  20. 1 point
    You took away the hover class that causes the tooltip to appear. The visibility never changes.
  21. 1 point
    Use inline elements inside the paragraph, like <span> instead of <div>.
  22. 1 point
    You are using position: fixed; outer container to surround your content, this will take it completely out of flow with other content, so because it occupies no space and with addition of overflow: hidden; on body, no scrollbars WILL appear to allow scrolling. You will get same on desktop, if you shrink the browser window to smaller size, or view it in responsive layouts under developer tools.
  23. 1 point
    That's a very broad question. It depends on how you want to classify them. You could classify them by hardware, by operating system, by server software or countless other features. By hardware there's a limitless amount of server configurations given the amount of memory, storage and processing. You can also distinguish between physical servers, virtual servers or server clusters. By operating system the two main categories would be Windows and Linux. Under Windows there are several versions, Linux has a whole lot of different distributions. The two biggest server software packages are Apache and IIS. IIS usually only runs on Windows servers.
  24. 1 point
    It doesn't really matter where you define those functions since there's going to be a delay before they get used (e.g., some action will send an ajax request, the page will get updated, then the functions will be used based on user interaction). You should probably just put them in a Javascript file that gets included on the page in the head with other things that can go in the head. But you'll need to make sure that the functions will get executed when the user does whatever you're checking for. If you're checking for a click event, then you can use jQuery to attach the event handlers so that the elements don't need to be on the page yet, you can do that by delegating the event handlers. You do that by specifying a selector when you attach an event handler using the on method: http://api.jquery.com/on/ So, for example, you would attach the event handler to a div that is eventually going to contain the dynamic content, but use a child selector to say that only buttons with the class "click-1" inside that div should receive the click events. As long as the container element exists you can attach those event handlers before the dynamic content is loaded, you would attach them in the ready handler.
  25. 1 point
    For many people, tutorials aren't explained in a way to them, where they can actually understand what they are saying, whereas if you had a human who can actively explain how to do something, like a javascript function to resize a window, then that should be fine.That is my opinion and I shall stick by it. ;O
×