You are not inside instance of class to use $this. Try this, it will work
require_once 'models/Request.php'; $req = new Request; if(isset($_POST['submit'])){ $data = [ 'reqBy' => $_POST['reqBy'], 'off' => $_POST['off'], 'prob' => $_POST['prob'] ]; echo "<pre>"; print_r($data); echo "</pre>"; if($req->addRequest($data)){ //This is the line where it points the error echo 'Sucess'; }else{ echo 'Something'; } } ?>
Related Posts:
- PHP – exit or return which is better?
- PHP Fatal error: Using $this when not in object context
- Where to get php_mcrypt.dll for PHP 7.2?
- When do I use the PHP constant “PHP_EOL”?
- How to use PHP’s password_hash to hash and verify passwords
- PHP password_hash(), password_verify()
- PHP &$string – What does this mean?
- PHP Notice: Undefined offset: 1 with array when reading data
- PHP – Failed to open stream : No such file or directory
- Weird PHP error: ‘Can’t use function return value in write context’
- Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 71 bytes)
- Simplest way to profile a PHP script
- Popup window in PHP?
- Subtract 1 day with PHP
- Warning: session_start(): Cannot send session cookie – headers already sent by (output started at [duplicate]
- PHP – Indirect modification of overloaded property
- “Maximum function nesting level of ‘100’ reached” after adding a new filter
- apache cpu over 70% on localhost
- Fatal error: Call to undefined method WP_Error::get_item_quantity()
- Fatal Error relating to sessions.php
- wp_ob_end_flush_all and wp_suspend_cache_addition()
- Why “Call to a member function on a non-object” in plugin only?
- fatal error call to undefined function get_header in index.php on line 1
- Getting error when using wp_insert_post()
- Fatal Errors on pluggable.php
- Syntax error in a shortcode function
- Fatal errors to undefined function in theme 404.php file [closed]
- PHP Helper Class to create shortcodes
- wordpress admin part is not accesbile after server shifting
- Error while loading wordpress site “Fatal error: Uncaught Error: Call to undefined function twentytwentyone_the_html_classes() in /home
- Replace old theme that understand old css (vcex_icon_box css_animation)
- Connecting to upstream failed
- Fatal error: wp-settings.php on line 199
- Reduce Stock Based on Custom Variation Field Rather than Attribute (Working Script)
- Fatal Error cannot log into wordpress and website disappeared
- pages disable after wordpress update
- Importing demo data in Multisite
- WordPress error on my website
- Changed URl in General Settings now WordPress site doesnt work
- Plugin Breaking WordPress Login
- WordPress won’t display errors at all
- WP white screen of death after duping a site that works fine on same server
- Catchable fatal error in appcloud free theme by Tokokoo
- How to fix ‘Call to undefined function do_settings()’ error?
- is_plugin_active() not defined on active plugin, in the thumbnails.php file
- White Screen When Includding A Folder With PHP Files
- Front-end major break after upgrade PHP 8.0 [closed]
- kali php problem [closed]
- Divi – add title to mobile menu button
- Why is the response on localhost so slow?
- How to fix Fatal error: Cannot redeclare get_cli_args() in class-wp-importer.php
- WordPress critical error after trying to update to 6.2 – Fatal error: Allowed memory size of 268435456 bytes exhausted
- Using prevNext Modx Addon
- What does “?” mean in Java?
- PDO with INSERT INTO through prepared statements
- What is the difference between a heuristic and an algorithm?
- How to integrate WordPress with Angular 8 for website?
- How to remove index.php from WordPress site URL
- How can I fetch loop of post titles via AJAX?
- How to change the wp-login.php page title?
- how to put the logo in the center of other items in the navigation bar
- Debugging an error: wp_enqueue_style was called incorrectly
- How do I hide specific user profile fields?
- Putting PHP variables into javascript [duplicate]
- Change the site tagline (or similar) based on current page
- hover image appears below placeholder instead of overlayed
- How to find error in my code when the error message is pointing to WP core file?
- Simple JS function Not Working
- Pass variable from one function to another
- AJAX load more for different custom post type loops
- How to edit widget code to add unique class name to each div?
- Parse error: syntax error, unexpected end of file
- How would I use this filter to change the output of the date format to “Twitter time”?
- Why i can’t get custom fields value or post ID via Ajax?
- Get value from db for custom contact form
- Uncaught TypeError: extract(): Argument #1 ($array) must be of type array, null given
- Redirect after scrolling the page
- add_action in namespace not working
- How to Send Pingbacks for all Posts in WordPress?
- Editing a coupon generating plugin
- Has a PHP update given me a 404?
- Replace background image with post thumbnail in shortcode
- Show code dependant on CPT & category
- Rewrite rule not working, but only when parameter is text
- How to prevent adding data to a localhost database after refresh?
- Fatal error: Class ‘RDTheme’ not found
- PHP warning with code for nav menu walker [duplicate]
- Creating Admin Submenu Page via Class Method
- media_handle_upload fails with gravity form submitted image
- how to display woocomerce description of each category in wordpress? [closed]
- Notify admin (by email) if post added with specific tag
- uploading a new theme to live server
- See output of a sql query while plugin installation in wordpress
- Shortcode Display From WordPress Dashboard Page Without Using post_id
- Warning: preg_replace(): Compilation failed: unknown option bit(s) set at offset -1
- Building a List of Posts grouped by custom taxonomy as the section header only to be displayed if at least one post is in that tax
- The Joel Test for system administrator jobs
- How do I rename a task in Task Scheduled on Windows Server 2008 R2
- how to create twitter card without plugin in wordpress website?
- How to use phpspreadsheet reader with $wpdb