-
Posts
15,227 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
filter table data using multiple drop box
requinix replied to Senthilkumar's topic in PHP Coding Help
You've given every field its own distinct <form>. If you want to access all the fields at once then you have to put them all in the same form. -
Back button doesn't appear to be working correctly.
requinix replied to KS3MAW's topic in PHP Coding Help
That's because your "back" button is not a back button. It's a link that takes the user to the URL of the previous page. Which, in all possibility, is not going to present them with the same information as it had when they left it. Question #1: Why do you have a back button at all? Question #2: Why aren't people using their own browser's back button? -
Facing the issue while upgrading php 7.4 to 8.1
requinix replied to prasant's topic in PHP Coding Help
You can overcome the issue by not installing PHP and its extensions manually. Revert the changes and installations you've made and go back to trying to use Remi's repo. What was the "No php package available" error you were getting then? -
I think the "modern" things are more along the lines of React. I'm old-school myself, still using jQuery for literally DOM manipulation - not even using its AJAX features anymore because fetch() exists. Something I had looked at a while ago was Backbone. Seemed like it was essentially the DOM updating stuff (like seen in React) coupled with some API conveniences.
-
Context of what you're doing?
-
Yielding the same object multiple times in a generator creates the sorts of problems you get like with SplFileInfo; I'd give a link to what I mean but I can't find one, so I'll summarize by saying that iteration on it (when a directory) yields the same object over and over, which means you can't do things like use iterator_to_array or even hold onto the iterated value for long. It's somewhat similar to the problem of foreaching with a reference. I recommend cloning the $obj each time - it's a test so who cares about performance and memory usage? public function someProvider(): \Generator { $obj = new SomeObject(); foreach([4,3,6,1] as $i) { $obj = clone $obj; $obj->setIndex($i); yield [$i, $obj]; } } (Or another solution where $obj changes. Depends on what SomeObject is and how much you can alter it for use as a provider.)
-
PHP doesn't see non-breaking spaces as whitespace. So it gets confused while parsing and will spit out seemingly random error messages.
-
Make sure you're using an editor which is not inserting obnoxious characters into your code. Such as non-breaking spaces, which I see a few of in there.
-
There are a few other problems besides that one... 1. Don't use inline styles. Learn and use CSS. It will make your life easier. 2. I don't think the name of the class is "table-borderrer". 3. If any of those values from the table contains anything that looks like it might be HTML then it will screw up your page. Instead of thinking about whether they will, assume they will: it's much easier. Use htmlspecialchars() when you want to output a value. 4. Similarly, if the name has any apostrophes then it'll break the link and you'll never be able to delete it. If you switch to using double quotes for your attributes then htmlspecialchars() will solve half of that problem. The other half is using urlencode() so that the name doesn't screw up your URLs. You can use them together with htmlspecialchars(urlencode(the value you want to output)). 5. Do you have a $buttonStyle variable? 6a. Things like deletes should not be handled through URLs you can see in your browser's address bar. They really need to be <form>s with method=post. You could stick a quick form in your table cell, but... 6b. If all you need to delete a booking is a single value then a <button> can do it. Wrap your entire table in a <form> then, in the table cells, use a <button> with type=submit (so it submits the form) name="Name" (this is the name of the booking) value=the name of the booking (remember to use htmlspecialchars, and since this isn't going in a URL you don't need urlencode). Inside the button's markup you can put the word "Delete". 6c. Either way, remember to fix your delete_booking.php to use $_POST. 7. Once again, if the name contains any sorts of symbols or spaces then it will screw up your query (for more reasons than that too). Don't try to escape the value. Do use a prepared statement.
-
Well, first question would be, what's changed recently? Because something has changed - software doesn't just randomly decide it's not going to work anymore. Second question would be if you can see any errors: stuff related to PHP, stuff inside your own browser (like while you sit on the alerts page), anywhere. It not working means that whatever changed is likely creating some number of error messages.
-
How to input 2 different $request->input() in foreach
requinix replied to Nicho's topic in PHP Coding Help
You have more than one other_emails. Don't you have more than one other_name too? -
Recursion is the idea of solving a problem by breaking it down into smaller problems that look similar but are a bit smaller. The classic example is the Fibonacci sequence: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55... It is defined as being F(n) = { if n <= 2 then 1; else F(n-1) + F(n-2) }. If you want to solve the problem of "what is the 10th Fibonacci number" then you apply recursion by (1) breaking it down into "what is the 9th Fibonacci number" and "what is the 8th Fibonacci number" and (2) adding the two results together. At the end you have what's called the "base case" which is the point where the problem has been broken down as far as it can go and you don't need to do any more recursion, which is "the 1st and 2nd Fibonacci numbers are 1". Let's say you have the problem "Is the string 8762395408668055932678 a palindrome?" What can you do to make that into a similar but smaller problem?
-
I could spend my time trying to do that, yes. Or I could suggest that you look into how to use databases, or perhaps just sessions, in PHP - you should be able to find tons of examples about those.
-
What do you mean "finding a palindrome of a number"? Because you don't really find palindromes... Do you want to check if a number is a palindrome? Like 12321 is but 1232 is not?
-
PHP will not remember $hasil from the last time you used the form. You have to store the data somewhere and then put it into $hasil before you display the form.
-
...is where it will be when you reach 10 posts.
-
How to input 2 different $request->input() in foreach
requinix replied to Nicho's topic in PHP Coding Help
Unless I'm missing something, you need to add the values for the new columns into the ::create array. And presumably those values are somewhere in the $request. -
Are you sure the user agent really starts with Test-Robot? Nothing else in there? The hyphen doesn't need to be escaped (it's not a special character) and /* means "zero or more /". You can put it in quotes just in case. RewriteCond %{HTTP_USER_AGENT} "!^Test-Robot/"
-
That's functional but not quite what modern Javascript code is supposed to look like. Want to spend some time improving it with our help?
-
What code have you tried so far and what did it output?
-
Right now the code assumes there is a file. $name = $_FILES['file']['name'] [$ID]; if(move_uploaded_file($_FILES['file']['tmp_name'][$ID],$target_dir.$name)){ What you need to change is have it first test if there was an uploaded file (the "error" in $_FILES is UPLOAD_ERR_OK). Then you only try to move the file if there was one. Then have your insert query not depend on moving that file.
-
Like I said, sometimes you need to step away from the computer for a while. I really did mean to do that, you know. Wasn't even joking.
-
I'm not talking about a column in a table. I'm talking about the PHP variable you have there called $voucher_code_in_transaction. Where is the line of PHP code that declares that variable?