Jump to content

justsomeguy

Moderator
  • Posts

    31,575
  • Joined

  • Last visited

  • Days Won

    77

Everything posted by justsomeguy

  1. You need to start the session before any code that tries to use the session. Every HTTP request is separate as far as PHP is concerned.
  2. You're the programmer. If you don't want to insert empty rows in the database, then check if the data is empty before inserting. Doesn't that sound like it would prevent empty rows? Seriously, a programming language is just the way that we tell computers what to do. You're the one telling the computer what to do. If you don't want it to do something, then make it not do it. It really is that simple.
  3. Well, it can get a whole lot of possible values. You'll need to understand the parts of it. [0-9] means any digit, if it's followed by a plus sign it means 1 or more digits. | means "or". A number in brackets, like {2}, means 2 of the previous character class. There should be plenty of regular expression references online if you want to look up specific things, or if you have specific questions you can ask here.
  4. justsomeguy

    SVG

    Necroing the oldest post possible probably isn't the best way to announce your presence.
  5. It will be better if you post your code here in the forum inside a code box, you'll find that you get help quicker than asking people to download a file.
  6. For deprecation, when something is deprecated the developers are signaling that it is going to be removed in a future version to give people time to move away from whatever was deprecated. They can still use the current version and whatever was deprecated will still be supported, but it's going to be removed soon.
  7. You need to check if the form is submitted. The last example on this page does that by checking the request method: https://www.w3schools.com/php7/php7_form_validation.asp That's not the only way to check if a form was submitted, but that's one way. Everything you want to do when the form is submitted needs to happen after you verify that it was actually submitted.
  8. You probably need to show an example of what you're specifically trying to do.
  9. You'll probably want to add some logging to see what's going on, print the coordinates of everything so you can see exactly what happens when you're dragging.
  10. You can make a Wordpress theme or a template for another CMS if you want to do that, or else you need to build your own CMS. If you're going to build your own then you need to get familiar with PHP.
  11. It's probably inserting blank rows because you don't do any validation, you don't check if anything was submitted before inserting, you just insert. All of the code after you close the database connection isn't doing anything, you have a typo in it but the only thing you do is run a function on things that would be in post. You don't do anything after doing that though. You should check to see if the form was submitted before inserting data.
  12. It sounds like you need to check if the child is outside of the parent coordinates at all, and if so by how much, and move it back so that it's within.
  13. Spammers will scan for unsecured email forms and try to use them to send whatever email they want. A basic form probably doesn't have a lot of anti-spam protection like using a captcha or another method to identify legitimate users versus spammers. If you don't know anything and don't want to learn how to do it you might just want to hire a programmer to add a secure contact form. If you're using something like Wordpress there should be quite a few plugins for contact forms.
  14. If you don't cancel the default behavior then the form submits, the page refreshes, and your code doesn't run.
  15. No, that's not correct. All code in Javascript runs in a specific scope. The scope is where it looks for defined functions and variables. By default the global scope is the window object, so anything defined on the window object is available everywhere unless it's overwritten. You can see scope in an example like this: var a = 'foo'; console.log('global a:' + a); function func1() { console.log('func1 a:' + a); } func1(); function func2() { var a = 'bar'; console.log('func2 a:' + a); } func2(); If you run that and look at your browser's console, you'll see it print the different values. The first 2 are the same. Inside func1, since a is not redefined, it uses the global variable a. In func2, a is redefined as a local variable, so it uses that instead. That is scope, where things are defined. Since the window is the default scope, you can refer to those variables and functions anywhere. So window.alert is defined to show an alert box, but since window is the default scope you don't need to use it, you can just write alert and the browser will still go up the scope chain looking for a function called alert until it gets to the window object. If you've seen document.getElementById, that's another example. The document object doesn't live by itself, it's also a property of the window object. So you could also write window.document.getElementById. So, no, you can't just substitute something else for window and expect it to work. It will only work if you've defined a function called alert on that object also: var obj = { alert: function(text) { console.log(text); } } window.alert('test1'); obj.alert('test2');
  16. Check your browser's console for error messages. There's not a lot of information here to go off.
  17. Either have PHP check and only include the Javascript to set the cookies if they've allowed it, or have the Javascript check the cookie before it tries to set its own.
  18. If you're required to use Progress, it looks like you may need to use an older version of PHP. I would contact them and try to find out what their plans are for support. If it's difficult to get in touch, I wouldn't use them.
  19. It sounds like you're not canceling the form submit event, so it's defaulting to the current page and the get method. You can verify that with an alert or console.log statement. Redirecting the ajax request isn't going to cause the browser to automatically redirect the main page, it just redirects the ajax request. If you want to redirect the user after the ajax response comes back then you need to redirect them using Javascript. You can have the PHP code return the URL to redirect to if it might change, and then actually redirect using Javascript.
  20. Are you connecting via ODBC? It sounds like they don't exactly keep their stuff up to date:
  21. Is the database server also 32 bit?
  22. That means there is a syntax error in the code. Your browser's developer console includes an area where you can look at all of the Javascript source code and set breakpoints to see if it's being executed. If the code is minified and all on one line that doesn't really help with breakpoints though.
  23. UTF8MB4 is what PHP doesn't understand. That isn't going to work. When I searched for that error message I saw people saying they fixed it by changing to regular utf8.
  24. A lot of the behavior you're seeing might be browser-specific. I would certainly never refer to an element just by its ID alone using something like input1.value, because eventually you're going to give an element an ID that already exists in the window object and then that's not going to work any more. getElementById always works. You can also use querySelectorAll to use a selector to find groups of related elements the same way you use a selector in CSS. I wouldn't use form.elementName either, not all browsers may support that. A form object has an elements collection which specifically contains the controls in the form. If your form has an input with the name "name", then does form.name refer to the name element or the form's name attribute? You want to avoid things like that, so if you want to iterate through the elements in a form then use the form.elements collection. https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement When in doubt, look it up on MDN and see what the specifications and browser compatibility say. The best code is code that is easy to understand. It doesn't matter how many characters are in document.getElementById, when you see that you know exactly what it's doing.
  25. What, specifically, are you trying to do? Are you saying you want to show 2 of them at once? You want a little picture with them? I don't understand the specific changes you are trying to make.
×
×
  • Create New...