Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by requinix

  1. Allow me to summarize the posts in this thread: (OP) I'm trying to learn OOP. Regardless, I have some problems with checkboxes in that I can't tell which checkboxes are which. (me) Checkboxes are only submitted when they're checked. If you need to know which fruits were selected then it requires looking at the values in the checkbox array. (Psycho) Don't use submitted data as field names in a query. The user could have done something malicious that will mess up your application. (OP to Psycho) I removed some code but I still don't know what's wrong. (OP to me) I completely changed the checkboxes and the code so it doesn't use an array. Here is some validation code that no longer works because it expected an array. (me) Why did you completely change how the checkboxes and the code look? The array from before was fine. (OP) So what do I do? It still doesn't work. Please give me code. Here's another explanation of what I want. (me) I don't know what "completely changed" is but you need the fruit name in the array somehow. You can then check if each fruit was selected using one of two methods. (OP) This isn't helpful. I'm going to take my question somewhere else. (me) I don't think that will make a difference. We weren't going to give you the new code. Not even sure we had enough information to do so. But we can try to tell you what is wrong and how it needs to be changed. Unfortunately, that wasn't good enough.
  2. At this rate, probably not. See how much spending money you have and hire a programmer to do the work for you.
  3. Seems like you're kinda just guessing. If you make the "ajax" a function instead of an object, then you can do whatever you want. Like make your own AJAX request. When you do that, you'll get back the information that the DataTable wants as well as the header string thing. Put the header string thing into your header element thing, then use the "callback" to hand the table data off for processing.
  4. Not the xhr event. I said "ajax". As in what I linked to in the documentation. As in "ajax": { method :"POST", url : '<?php echo admin_url('admin-ajax.php');?>', data : {action:action,tax:tax,id:id,}, }, that.
  5. I don't know what your checkboxes look like now, but you've put the name of the fruit as an array key or as an array value. If you put it as a key then test if each fruit was selected using isset(). If you put it as a value then test using in_array().
  6. How about you go back to using an array? I don't understand why you had to change that. It was fine.
  7. The thing you pass as the "ajax" value needs to be a function. It take a few arguments, as seen in the documentation, and when it's done it uses the callback function it received. What code do you have trying to do that? What do you expect to happen when you view the table and what actually happens?
  8. So what you need is to be able to customize how the DataTable does the AJAX request, right? You can perform the actual request yourself, then give the DataTable just the "example" data while you borrow the "search-results-header" data for something else. When in doubt, check the documentation.
  9. What? Do you want to add that markup to the page? Or are you trying to return a value from PHP that should be inserted into that DIV which is already written on the page?
  10. A checkbox is only submitted when it is checked. You cannot simply look at [0] and [1] and so on to know what value it has. The answer is, hopefully not too surprisingly, to look at the value. You've got it right there. fruit_selection will be an array and all you have to do is see if that array contains each fruit.
  11. I'm not sure there even is anything wrong. Not with the code. You know what this thing does, right? You feed it a nickname and the script looks for IP addresses it used, then for each of those it finds nicknames, then for each of those it finds IP addresses, and so on until it runs out of stuff. You searched for "Matej_Cizik"? Look in the database table yourself for that nickname. Does any of the data seem to be off? Then try searching according to the IP addresses you just found. Then those nicknames. Does it seem to be spiraling out of control?
  12. Programming isn't like piecing together LEGO blocks. You can't just go onto the internet and get an "admin dashboard" component and shove it into your application. If you're working with WordPress or some other cookie-cutter framework then there might be a plugin out there to do what you want. Otherwise you'll probably have to (gasp) learn some PHP and HTML and CSS. Because it's not like there are people out there who know your website and are climbing over each other to write free stuff that will work with it in the hopes that you'll go download their thing.
  13. The #1 way to have vulnerable code is to copy and paste what you find on the internet. There is no substitute for learning PHP and secure coding practices. That said, the thing you found is actually one of the safest versions I've seen in that it does not fall prey to any of the common problems that plague most of what you'll find online. Would be nice if they talked more about it, tried to address issues like file permissions or access control, but I suppose this is one of the few good examples of w3schools doing things right. Good developers write good code. Bad developers write bad code. Language has nothing to do with it.
  14. Make an upload script. The internet has a lot of resources to help with that. Be careful that you don't allow anybody who stops by to upload anything they want. Put the files somewhere not accessible through your website with a regular URL. Make a download script. Specifically, you need a PHP script that will download the requested file to your browser. Also lots of resources to help with that. URL rewriting would help. Then update that download script so it deletes the file after sending its contents.
  15. Check your variable names. By the way, when a word is plural that normally means there is more than one, and the singular version is when there is just one.
  16. ->fetch() only gives you one row at a time. If you look at what's available to use you'll probably find something more like what you're expecting.
  17. You're much more likely to get some help if you can show some initiative on your part first. Like, if you've tried writing the code yourself. Or if you have something partially done to show and don't know how to continue with it.
  18. You'll have to do that. Educated guess says the image has to be a monochrome (B&W) bitmap.
  19. All you have in that array is the firstname. That's not unique. You need the first and last names. Also, don't add them as array values. When it comes time to look up a value in there with in_array(), PHP will have to scan potentially the whole array to find a match. A faster method is to use array keys; put the whole $row as the value. Well, for starters, I don't see anything trying to use $names in there. Since you're going with the approach I said before about having the first and last names be the array key, you can use isset() to tell if there is an entry according to the name parts from $item.
  20. How does that work, exactly? Does the USB show up as a file device you can just copy files to? What does that process require you to do?
  21. Check what I said again. Your query on the database (1) needs to set up an array that holds all the records in it so you can look in there for a match easily, and therefore (2) it has to happen before the foreach.
  22. Putting a database query into a loop is almost always a bad idea. Do one query ahead of time that looks up every record, then stuffs it into an array. You can use the firstname + lastname (that being the only unique (?) piece of information you can work with) as the array key, and for fun the entire row of data as the array value. Then your foreach loop checks that array for a match.
  23. Removing the battery from a fire alarm does not make the fire go away.
  24. You're saying you can open a popup window, handle clicking on a radio button, and update the parent window's form data, using only HTML and CSS? I'd love to see that.
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.