Jump to content

maxxd

Gurus
  • Content Count

    883
  • Joined

  • Last visited

  • Days Won

    22

maxxd last won the day on February 26

maxxd had the most liked content!

Community Reputation

59 Excellent

About maxxd

  • Rank
    Prolific Member

Contact Methods

  • Website URL
    https://maxxwv.com

Profile Information

  • Gender
    Not Telling
  • Location
    North Carolina

Recent Profile Visitors

12,515 profile views
  1. maxxd

    Site Won't Submit Multiple Variables

    Also hint: In the long run, using either checkboxes or a multi-select combobox will make your life much easier when dealing with this.
  2. What's in this field? It could just be my own personal naming style but this kinda seems like it would hold the referrer value, which sounds like what you want. So, you may have all the information you need already. Otherwise, do as ginerjm suggests and create an additional hidden field with the value you need.
  3. maxxd

    php coding to send email from html form

    Honestly, just formatting your code properly is going to help. You've got single-line comments that are (right now) commenting out functionality due to everything being on one line. Put the comments on separate lines or remove them entirely. We'll be able to figure out what your script is doing, I promise.
  4. maxxd

    php coding to send email from html form

    OK. Now we can safely say the issue is not just in what was originally posted. Format the source code, then post it here again please. It's still unreadable.
  5. maxxd

    php coding to send email from html form

    gw1500se means in your original post here, not the code itself. Notice the button that looks like '<>' in the editor toolbar - that formats code. The code you posted isn't readable on this forum so please edit it and use the code format.
  6. maxxd

    <?php echo "\n" sourcing

    I don't know what theme or plugin you're using, but there are a couple potential issues with how you're going about things. First, modifying the theme or plugin files directly is not recommended because every time the plugin or theme is updated, your changes will be overwritten. Usually in this type of situation, you'd check the files and documentation for action or filter hooks and use those to make your updates from your functions.php file. Working this way will allow those changes to remain after the plugin or theme updates because the actual theme or plugin files haven't been changed. Another things is - given the name of the static method called (frontSections()) I assume this is calling your installed theme's functions that load the head and/or header templates into the page. These are crucial to the functioning of your site as it creates the top half of the HTML page - I think this is probably why you're seeing the WSOD when you remove this call. So, you know, don't do that. Let us know what you're looking at and what about that you're trying to change, and I'm sure with the brains on this board you'll find the help you need to do what you want and do it correctly.
  7. maxxd

    PHP and querystring problem

    Do you have control over the building of the link? Because there should be an ampersand before the 'from' variable (not the question mark), and the value of from should be url-encoded. I'm pretty sure this would take care of your issue. If you don't have control then honestly I'm not sure exactly how you'd fix the issue - maybe parse_url()? Not entirely sure what it does with slightly malformed URLs such as yours, but there's a possibility you can use this and ginerjm's explode() suggestion to figure it out, I guess.
  8. maxxd

    JSON naming convention

    I know - I can't stand snake case, but if it's an array key or database *anything*, my fingers just type it that way. Database tables and columns actually make sense to me because I have a tendency to prepend table names with "tbl_". In case I get confused, I guess. But "tbl_student" or "tbl_orders" reads easier to me than "tblStudents" and "tblOrders". And once you've got that established for table names, you might as well keep it going for the column names because then you don't have to think too much or type different patterns in the middle of custom MySQL statements. It makes perfect sense. Really. The array key thing I can't even pretend to explain, it's just something I realized I was doing at some point. I may have been dropped on my head as a child.
  9. maxxd

    JSON naming convention

    I align almost exactly with @kicken except I use snake case for database, table, and column names, and - for whatever random reason - array keys. Couldn't explain the array key preference if I absolutely had to as I really do hate snake case. Unfortunately, I currently work with WordPress so I have see that crap daily...
  10. maxxd

    Unexpected end of JSON input

    Yeah, Jason Larke's answer is pretty much exactly what taquitosensei and I have been saying. No. The 'public statements' before the __construct() method are called object properties or object variables. The reason I'm passing in 4 random values is because the constructor signature calls for 4 parameters to be passed in; you've got The first 0 is now assigned to $role, the second is $tag, third is $location, and fourth is $job_id. They're not used in the class you've written, so I passed in nonsense values. There's a bunch of different reasons for having multiple files. The biggest is that AJAX is a client-side technology, but database interaction is a server-side technology. So you need to have the JavaScript file and a PHP file. The JavaScript is separate from the HTML file because if it was all in the same file you'd run a decent chance of breaking the functionality every time you change a DOM element. The PHP is the server-side file that actually gathers the data and prints it back to the AJAX call. Adding the lines above to the jobsDatabase.php file will automatically create an instance of the jobsDatabase class and run the getAllRoles() method of that object, which in turn prints the gathered data. Basically, you're dealing with a whole lot of moving parts with what you're trying to do. Given what we've talked about, I'll recommend again just stubbing in the data - instead of trying to use an additional PHP file to connect to the database and gather the actual data, just make up an array and print it to the AJAX call. In the AJAX success() callback, print that data to screen or console. Once you see the data you're expecting, move on to the next stage - in this case, populating the returned data in the form. From there, worry about actual database interaction. Hopefully at least some of that makes sense - again, it's been a bit of a Monday here.
  11. maxxd

    Unexpected end of JSON input

    If that's all the code there is and you're not using a framework, then yes, you need to call the method on the object. Add this to the bottom of your file: $job_data = new jobsDatabase(0,0,0,0); $data = $job_data->getAllRoles(); die($data); Note that anything happening here is dependent on the contents of connect_database.php. While you're learning it may be a little easier to create a static array inside getAllRoles() and output that. That way you know everything is self-contained and you know what you're expecting. This should make it easier to track down any issues and errors in the process.
  12. maxxd

    Unexpected end of JSON input

    Did you write jobsDatabase.php yourself? Are you using a framework or library?
  13. maxxd

    Unexpected end of JSON input

    Right, and we need to see what the actual JSON string is. If you're using Chrome, select 'More Tools > Developer Tools' from the menu (option - command - uppercase 'i' on a mac, Ctrl + Shift + uppercase 'i' on Windows). You'll see the 'Network' tab along the top - select that, then trigger your ajax call. You'll see 'jobsDatabase.php' under the 'Name' column. Click it, then select the 'Response' tab from the details screen that appears. This will show you the raw JSON output, which may have a slightly more helpful error message.
  14. maxxd

    Unexpected end of JSON input

    I just took a look at the code again. I missed the 'method' in your data set - so, yes it's possible that is all being handled behind the scenes and not something you need to worry about. (Sorry - it's Monday in a big way here...) So that begs the question, what does the response show in your browser's devtool's network tab?
  15. maxxd

    Unexpected end of JSON input

    From the jQuery documentation: The AJAX call will connect with the script assigned to the url parameter of settings object. In that script is where some action has to take place. For instance, in WordPress you pass a field named 'action' in your dataset to admin-ajax.php. admin-ajax.php then uses the value of that field to know what PHP functions to call in order to get you the data you need. What taquitosensei and I are suggesting is that you add the following to the end of he script - after the closing bracket of your class definition: $job_data = new jobsDatabasee(); $data = $job_data->getAllRoles(); die($data); and change `echo $json` to `return $json` inside the getAllRoles() method. Before you do that however, what does the response header show in your devtool's network tab after the AJAX call has been made?
×

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.