Jump to content

benanamen

Members
  • Posts

    2,134
  • Joined

  • Last visited

  • Days Won

    42

Everything posted by benanamen

  1. Using a DB is overkill for this. You should also be using the month number for the key, not the month name. <?php $months = [ "1" => "January", "2" => "February", "3" => "March", "4" => "April", "5" => "May", "6" => "June", "7" => "July", "8" => "August", "9" => "September", "10" => "October", "11" => "November", "12" => "December" ]; ?> <select name="month"> <option>Select Month</option> <?php foreach ($months as $month_number => $month_name):?> <option value='<?= $month_number ?>'><?= $month_name ?></option> <?php endforeach;?> </select>
  2. I have to jump in as well. Your post is probably the #1 worst way to ask for help. The only thing that is missing is the "Urgent, I need it fixed by tommorow".
  3. I am available for hire. My contact is in my profile.
  4. Instead of doing the includes, why don't you start with a single page of code and get that to work first. The index error is because you are trying to use a POST variable before it is set. You need to make sure it is set before you try to use it. Your code is so all over the place I can't even follow it well. I will leave it to others to take it from here unless you can post revised single page code.
  5. You are using print_r wrong and several of them are formatted wrong anyways. Replace all the print_r's with echo but even then, the code is still badly written. There is no need to echo/print $100% HTML. http://php.net/manual/en/function.print-r.php
  6. There is no need for Ajax. Basic form handling is all you need. <?php if ($_SERVER['REQUEST_METHOD'] == 'POST'){ // Send email code die('Thank You!'); } ?> <form method="POST"> <label>Name</label><br > <input name="Name"> <input type="submit" value="Submit" > </form>
  7. You want the function array_diff http://php.net/manual/en/function.array-diff.php
  8. That is a lot more useful info than how to handle your attempt at it. Not sure if it is, but it was smelling of an XY Problem to me. Are you able to provide details on the "Certain Data" and exactly what it means regarding more or less data? Any other details may also be helpful. Are you in control of the source data? If not, what are your options in retrieving it? Are we talking about a third party API? Edit* Is this a third thread regarding the same project as your other two threads? https://forums.phpfreaks.com/topic/302727-multiple-updates/page-2 https://forums.phpfreaks.com/topic/302752-insert-on-duplicate-key-update-with-composite-key/
  9. What is it that you are actually working on, meaning, the overall task, not your attempted solution to it?
  10. Your methods are just ridiculous. Stop creating a bunch of variables for nothing. The whole Class_info.php need to be thrown in the trash. It is just a container for a bunch of variables for nothing. You have an HTML5 document yet you are using XHTML tags.
  11. I have a lot of respect for @requinix for that approach.
  12. Thumbs up to you @dudleylearning. It says a lot about you as a coder. Many posters just want someone to spit some code out to them and don't care if it is correct as long as it 'works'.
  13. Now you need to update your code to use prepared statements. You NEVER EVER send user supplied data directly to the database. Your code is vulnerable to an SQL Injection Attack.
  14. What you are looking for is called "Auto Complete". It is the same thing google does. It uses AJAX. Google is your friend. I easily found numerous examples. There is no need split the data unless you want to get results by category like @Barand said. The only thing with categories is a medicine can fall into numerous categories. If you do not have that all mapped the user may have trouble drilling down to a specific medicine. A single autocomplete is best if they already know the name of the medicine. You may actually want both options, one if you know the name, the chained select if you are trying to find a type of medicine. https://www.google.com/search?q=php+autocomplete+dropdown+from+database
  15. You have name set to not allow nulls and there is no default value set for that column. In your query you do nothing with the name column. As you have it, you can think of 'name' as a required field.
  16. No it won't. To answer your question, yes, there is a problem with the way you wrote it.
  17. And there's your "problem". Wordpress is not going to run code in a post. That would be a MAJOR security problem if it did.
  18. I personally am not comfortable running an encoded app from a source with no reputation of trustworthiness. There could be anything in that code. The app does look interesting though.
  19. @requinix, nice job with the trial and error approach with the OP. That is my prefered method of teaching rather than spoon feeding answers. He will learn better this way IMHO.
  20. You have all kinds of problems. 1. Stop using Dream Weaver and use a proper IDE 2. Stop needlessly mixing all your html with php 3. Learn how to properly use heredoc 4. Don't post code with all the line numbers. Our own proper IDE's will give us the line numbers if we need it. 5. Basically your Php processing should be at the top of the page and the HTML at the bottom, although you should be at least separating the HTML from the page with an include or ideally use a proper template engine like TWIG. 6. You can't be mixing quote types. 7. Your missing brackets 8. Your missing parenthesis 9. Your missing quotes. If you used a proper ide you would have seen all those careless mistakes. The code is full of it from top to bottom.
  21. Same here. Are you talking about something like this? https://forums.phpfreaks.com/topic/302370-router-any-issues-comments/
  22. I agree with @Barand on the single table. Whenever I see UNION being used on a forum the DB design is always not properly normalized.
  23. Another version <?php $i = 1; while ($i <= 5) { echo str_pad('', $i, '*') . '<br>'; $i++; } ?>
×
×
  • 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.