Jump to content


Popular Content

Showing content with the highest reputation since 07/24/2019 in all areas

  1. 1 point
    Your for needs a method="POST" attribute.
  2. 1 point
    From the manual: u (PCRE_UTF8) This modifier turns on additional functionality of PCRE that is incompatible with Perl. Pattern and subject strings are treated as UTF-8. An invalid subject will cause the preg_* function to match nothing; an invalid pattern will trigger an error of level E_WARNING. Five and six octet UTF-8 sequences are regarded as invalid since PHP 5.3.4 (resp. PCRE 7.3 2007-08-28); formerly those have been regarded as valid UTF-8.
  3. 1 point
    Add the u modifier to your pattern: /[^A-Za-z0-9!\"#%£&()=@\s]/u
  4. 1 point
    Thank you Funce ! I will study this until I understand every 'jot and tittle' . You moved me to start a Folder for w3schools-Examples . http://vmars.us/w3schools-Examples/Draggable-Div-Elements-w3Schools-FUNCE.html Thanks again
  5. 1 point
    You can use a case expression: https://docs.oracle.com/cd/B19306_01/server.102/b14200/expressions004.htm SELECT CASE bool_field WHEN 0 THEN 'No' ELSE 'Yes' END ...
  6. 1 point
    Type attribute is no longer required.
  7. 1 point
    You can put that tag in the head to load that file, and the code in that file should use the DOMContentLoaded event to make sure the code runs after the page finishes loading.
  8. 1 point
  9. 1 point
    Each cookie is just a generic data store, it just has a name and a value. The value can be anything the site wants to set (within size limitations) and doesn't need to be human-readable, maybe it's just an ID string to match up with a database somewhere, maybe it's encrypted data that the site decrypts. There are other properties that cookies can have but that's the basic idea, just a name and a value.
  10. 1 point
    Add a return statement before the recursive call. You want to return the value of the recursive function.
  11. 1 point
    Try it and see what happens. You can use array indices with a string to access different characters of it, e.g.: $string = 'some string'; $string[4] = '-'; echo $string; But you're trying to use an array index which is a string: $string = 'some string'; $string['r'] = '!'; While it shouldn't be hard to figure out which character in that string is in the 4th position, it doesn't make much sense to try and figure out which character is in the rth position.
  12. 1 point
    No, the problem is that you declared $result['rgb'] as a string ('rgb' => '') instead of an array, so it cannot have strings (such as 'r', 'g' or 'b') as an index. This would also be an issue in PHP 5, but you probably had the settings hiding the warnings.
  13. 1 point
    The ">>> 0" part converts the signed integer into an unsigned one, so that you can get the computer's actual representation of negative numbers. The ".toString()" part is the one that does the conversion to binary. When you put "2" as an argument it indicates that you want a base 2 representation, which is binary. If you gave it "10", it would give you the number in our familiar decimal system. For negative numbers, what you'll get is the way computers represent negative binary numbers. A negative binary number is represented by subtracting 1 from its positive value and then flipping all the bits, which means switching 0s for 1s and 1s for 0s. The reason they subtract 1 is because if they did not, there would be such thing as negative zero, which doesn't make sense in regular math. Keep in mind that this is only how computers represent negative numbers. In real binary a negative number is just a positive one with a "-" preceding it just as in the decimal system. If you want the mathematical binary representation then remove the ">>> 0" part.
  14. 1 point
    mysqli_stmt::bind_param binds each variable to a matching parameter. You cannot match all of them to one. It doesn't work like that. (Neither can you attempt to use a string like an array) What you can do however, is bind an array using variable length argument lists. Use ... to indicate an argument list as below. <?php $vals = [101, "ASUS H61M-E", "abcde", 2, 1, 5300.00, 6500.00, 11, 5300, 55528, 101]; $uq = $mysqli->prepare("UPDATE $tbl SET $cols WHERE $whcol='$whval'"); if (!$uq) { $msg = "Error1: $mysqli->error!"; } else { $uq->bind_param('issiiddiiii', ...$vals);
  15. 1 point
    I just copied that code to a .html file on my computer and it seems to work correctly.
  16. 1 point
    It looks like captcha_sa is already a global variable, so just set it with the new value.
  17. 1 point
    dsonesuk Here's what I mean , see image :
  18. 1 point
    The browser doesn't care what the filename is, just make sure it's right: <script type="application/javascript" src="image.jpg"></script> The browser isn't going to complain about an extension, have you ever seen an error message like that? It's going to download the file you tell it to and treat it like you're telling it to treat it, the browser assumes that the programmer knows what they're doing. If the file has an extension that PHP is configured to handle, then when your browser sends a request for the file the web server will send it to PHP and send the output to the browser, like with any other request. It's not a security problem, just efficiency. There's no reason to have PHP try to parse a bunch of file types that will almost never have PHP code in them. I just use .js.php when I want to indicate a PHP file that should output Javascript. That's what it's for.
  19. 1 point
    Requesting a Javascript file isn't going to run any PHP code unless the web server is configured to send .js files to PHP. You could name the file with a .php extension if you need to dynamically create Javascript code for whatever reason.
  20. 1 point
    If you use include_once or require_once to include files in PHP then it will only include the same file once even if there are multiple include statements. Hopefully you have a main PHP include file that your other PHP files include that defines various global functions and variables, and that would be the place to include any file that you want available on any other page.
  21. 1 point
    They don't show on smaller devices, you are then stuck with using [ code ]....[ /code ] (without spaces);
  22. 1 point
    Hey there vmars, your issue here is that getElementByID only ever gets one element. getElementsByClassName gets a collection of elements, so some things needs to be adjusted. You'll need to apply the DragElement function to all of the Elements in the collection. (For loop might work well) Your headers will no longer work as they use the passed element's id. You'll need to apply a "header" custom class, one that will exist on all the headers. You can then access this header element for dragging purposes by using the below code. function dragElement(elmnt) { var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0; if (elmnt.getElementsByClassName("header")[0]) { /* if present, the header is where you move the DIV from:*/ elmnt.getElementsByClassName("header")[0].onmousedown = dragMouseDown; } else { /* otherwise, move the DIV from anywhere inside the DIV:*/ elmnt.onmousedown = dragMouseDown; } Try this and then go from there. Code block button is here if you've missed it. ev.target evaluates into the element that has been activated using the event (onmousedown, onmousemove etc). That will always evaluate to the .mydiv that was clicked. So rather than document.getElementById, you use ev.target inside this function.
  23. 1 point
    Any database supports multi-user access, the database will let several different applications connect at once. I don't know what you mean, what are you saving? That's what a database is for. Have page to update the header text in the database, and the other pages should get the text from the database and display it.
  24. 1 point
    justsomeguy is right, if you have complex data, better to store it in a database, server-side or client-side. Even HTML5 (using JS) has a way to store data called webstorage. Choose the way that suits you best
  25. 1 point
    Javascript running in a browser only has access to the current document. Trying to do anything else would be a series of hacks. You could put a bunch of hidden iframes or something on the page to point to different pages if they're on the same domain and try to access things through that. A much simpler and more useful solution would be to store your data in a database instead of in HTML files. Depending on what the purpose is, you can save the various values in localStorage or sessionStorage to access on other pages.
  26. 1 point
    OK. I get it.! The properties value and enumerable are property descriptors. They define the nature of the property getFoo. Thanks! Roddy
  27. 1 point
    The second argument of the Object.create() method contains property definitions which follow a specific format. In your code, the definition of getFoo is saying that its value is a function and that it is enumerable. You can see all of the different features that a definition can have here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperties#Parameters If you want your code to behave as you predicted, just drop the Object.create() method and assign the object directly: var jsonLinkObj = { getFoo: { value: function() { return this.foo = 1; }, enumerable: false } }; The purpose of Object.create() is mainly for copying existing objects, if you are just creating a new one you probably don't need it.
  28. 1 point
    It sounds like you think your code is the same as this: var jsonLikeObj = { getFoo: { value: function() { return this.foo = 1; }, enumerable: false } }; It's not, that's not what Object.create does. That second parameter is a description about how to create the object, it's not the actual object. jsonLikeObj.getFoo.enumerable is also undefined. Why? Because that's not the actual object, it's the specification for the object. It's metadata. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create
  29. 1 point
    Iframes pose their own problems, one of the biggest ones being that the pages in the iframe don't have their URL shown in the address bar, which means that people (and search engines) cannot link back to them.
  30. 1 point
    Probably the easiest and best solution is to install XAMPP or similar server software on your computer. It is very easy to install and there are many more uses for it than just making AJAX requests work. It is default in all browsers today to prevent AJAX requests from local HTML and Javascript files because it could be used by malicious entities to gather information about your computer. There probably is a way to configure the security settings for this but I'd have to search on Google to find out, which is probably something you already know how to do. For Firefox, you probably will find it by typing "about:config" in the address bar which lets you search through thousands of configuration options. I would advise against Javascript includes for a few reasons: Search engines will certainly rank your page lower. Users who have Javascript disabled or browser extensions that strip out Javascript can't see your page properly. The page takes longer to load than if the content were included on the page using a server-side language, this is especially noticeable when viewing the page on mobile connections. If you decide to install a server for testing, I'd also recommend learning a server-side language and using that to include the content instead. It's overall a better experience for the user, the search engines and, in the long term, the people building the website.
  31. 1 point
  32. 1 point
    I'd remove all text direction modifiers. They are the Unicode characters 202A, 202B, 202C, 202D, 202E, 202F.
  33. 1 point
    Without syntax highlighting, brace matching and auto indentation, a simple editor like that is not very useful.
  • Create New...