Symphony Route returns a 404 status code in the frontend

I am working on a Symphony app and have tried to create a route using PHP. The problem is that even though the route is correctly defined in the backend, I get a 404 status code in the frontend when I try to retrieve the route.

Backend:


/**
* @Route("/fetch-stock-data")
*/

public function fetchStockDataAction(Request $request) {
    $this->disableViewAutoRender();

    session_start();

    $currentTime = time(); 
    $oneHour = 60 * 60; // 3600 seconds

    if (!isset($_SESSION['stock_data_timestamp']) || $currentTime - $_SESSION['stock_data_timestamp'] > $oneHour) {

        session_write_close();

        $apiKey = "KEY";
        $symbol = "AAPL";
        $queryURL = "https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol={$symbol}&outputsize=full&apikey={$apiKey}";

        $response = file_get_contents($queryURL);
        $data = json_decode($response, true);

        session_start();
        $_SESSION['stock_data'] = $data;
        $_SESSION['stock_data_timestamp'] = $currentTime;

    } else {
        $data = $_SESSION['stock_data'];
        session_write_close();
    }

    return new JsonResponse($data);
}

And this is my front-end code:

var apiUrl = `/fetch-stock-data`;

$.get(apiUrl, null, function (data) {
    globalStockData = data["Time Series (Daily)"];
    document.getElementById('cookieConsentMessage').style.display = "none";
    updateChart();
}).fail(function() {
    console.error("Error with response:");
});

Does anyone have any idea why I get the 404 error when I call the route?

Woocommerce refund and exchange plugin sending empty email

When the client request a refund of the order, woocommerce RMA plugin is sending an empty refund email to my client/users. No subject, no content.

Additional problem is that the mail configuration(Woocommerce->RAE Setting->Mail Configuration) redirects to 404 page in client page and not in admin panel page.

P.s: I’m using outlook for my emails.

Empty Email

Unique id to be generated through php

I want a id to be generated in php The Id has to be started from AB0001. And when 10th row inserts the Id has to be AB0010. How can I generate the id this way in php.
In my code the id will be generated in this way

$id=”AB000″.mysqli_insert_id($con);

I want The id to be only 5 letters. Not more than that.

The Id has to be started from AB0001. And when 10th row inserts the Id has to be AB0010. Only 5 digit Id has to be generated

File not uploading using laravel in godaddy hosting

File not uploading using laravel in godaddy hosting.

I shift my website from interserver to godaddy. On godaddy file not uploading. before shifting it was uploading files. My website is created in laravel. PLease let me how can i fix this issue.

See code below:


 $avatarPath = $this->uploadFile($request->file('avatar'), '/avatars'); 


  function uploadFile($file, $path = '/uploads', $fileName = null) 
    {
        if($fileName) {
            $fileName = time() . '_' .  $fileName;
        }  else {
            $fileName = time() . '_' . $file->getClientOriginalName();
        }
        $file->storeAs($path, $fileName, 'public'); // Save the file to the 'storage/app' directory
        $filePath = '/storage'.$path.'/'.$fileName;
        return $filePath;
    }

GA4 analytics tool

I want to fetch all GA4 data in my CRM, basically want to do the GA4 analytics tool

basically want to do the GA4 analytics tool.

Any APIs are there to create a tools? Please help us here.

Is the any APIs or free code for review is available?

javascript and php to change string by specific rule [closed]

how to let

a1(b)w; b5(a)w;

become

a1w;abw;b5w;baw;

using javascript and php?

which means that:

  1. remove parenthesis.
  2. generate a string without parenthesis and its content.
  3. generate another string with the content in parenthesis and remove one character before the “(“

I tried to split the string first but it’s too complicated.

the status is not updated

I bring up the favorite status from api, and it appears that it is saved in favorites, but only when I restart the application it just does not save the favorite status.

**
this when i click the button**:enter image description hereز.

when i make run app
enter image description here.

this debuging enter image description here

the ui code :


`
class CustomListItems extends GetView<ItemsControllerImp> {
  final ItemsModel itemsModel;
  // final bool active;
  const CustomListItems({Key? key, required this.itemsModel}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return InkWell(
        onTap: () {
          controller.goToPageProductDetails(itemsModel);
        },
        child: Card(
          child: Padding(
            padding: const EdgeInsets.all(10),
            child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [ 
                  Hero(
                    tag: "${itemsModel.itemsId}",
                    child: CachedNetworkImage(
                      imageUrl:
                          AppLink.imagestItems + "/" + itemsModel.itemsImage!,
                      height: 100,
                      fit: BoxFit.fill,
                    ),
                  ),
                  const SizedBox(height: 10),
                  Text(
                      translateDatabase(
                          itemsModel.itemsNameAr, itemsModel.itemsName),
                      style: const TextStyle(
                          color: AppColor.black,
                          fontSize: 16,
                          fontWeight: FontWeight.bold)),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      const Text("Rating 3.5 ", textAlign: TextAlign.center),
                      Container(
                        alignment: Alignment.bottomCenter,
                        height: 22,
                        child: Row(
                          children: [
                            ...List.generate(
                                5,
                                (index) => const Icon(
                                      Icons.star,
                                      size: 15,
                                    ))
                          ],
                        ),
                      )
                    ],
                  ),
                  Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text("${itemsModel.itemsPrice} $",
                          style: const TextStyle(
                              color: AppColor.primaryColor,
                              fontSize: 16,
                              fontWeight: FontWeight.bold,
                              fontFamily: "sans")),
                      GetBuilder<FavoriteController>(
                              builder: (controller) => IconButton(
                                  onPressed: () {
                                    if (controller.isFavorite[itemsModel.itemsId] ==
                                        "1") {
                                      controller.setFavorite(
                                          itemsModel.itemsId, "0");
                                      controller
                                          .removeFavorite(itemsModel.itemsId!);
                                    } else {
                                      controller.setFavorite(
                                          itemsModel.itemsId, "1");
                                      controller.addFavorite(itemsModel.itemsId!);
                                    }
                                  },
                                  icon: Icon(
                                    controller.isFavorite[itemsModel.itemsId] == "1"
                                        ? Icons.favorite
                                        : Icons.favorite_border_outlined,
                                    color: AppColor.primaryColor,
                                  )))
                    ],
                  )
                ]),
          ),
        ));
  }
}


`

favorite controller:

class FavoriteController extends GetxController {
  FavoriteData favoriteData = FavoriteData(Get.find());
  

  List data = [];

  late StatusRequest statusRequest;

  MyServices myServices = Get.find();

  Map isFavorite = {};

//  key => id items
//  Value => 1 OR 0

  setFavorite(id, val) {
    isFavorite[id] = val;
    update();
  }

  addFavorite(String itemsid) async {
    data.clear();
    statusRequest = StatusRequest.loading;
    var response = await favoriteData.addFavorite(
        myServices.sharedPreferences.getString("id")!, itemsid);
    print("=============================== Controller $response ");
    statusRequest = handlingData(response);
    if (StatusRequest.success == statusRequest) {
      // Start backend
      if (response['status'] == "success") {
        Get.rawSnackbar(
            title: "اشعار",
            messageText: const Text("تم اضافة المنتج من المفضلة "));
        // data.addAll(response['data']);
      } else {
        statusRequest = StatusRequest.failure;
      }
      // End

    }
  }

  removeFavorite(String itemsid) async {
    data.clear();
    statusRequest = StatusRequest.loading;
    var response = await favoriteData.removeFavorite(
        myServices.sharedPreferences.getString("id")!, itemsid);
    print("=============================== Controller $response ");
    statusRequest = handlingData(response);
    if (StatusRequest.success == statusRequest) {
      // Start backend
      if (response['status'] == "success") {
        Get.rawSnackbar(
            title: "اشعار",
            messageText: const Text("تم حذف المنتج من المفضلة "));
        // data.addAll(response['data']);
      } else {
        statusRequest = StatusRequest.failure;
      }
      // End
    }
  }
}

the api It returns 1, meaning that it was stored in the data base and there is no problem with the back and forth

Are PHP warnings and fatal errors after an upgrade to 8.2 important, or are they just harmless deprecation notices?

A contractor that is responsible for a PHP-based website on a host that I’m supervising recently migrated the software to PHP 8. Since then the web server logs are full with a lot of error messages that it receives from the PHP interpreter, see the samples below.

I asked the contractor what this means, particularly with regards to the site’s reliability and I expressed my concern that such a flood of messages is noise in case of a problem. The answer I received stated that these would be harmless deprecation warnings that were introduced with PHP 8.2.

As someone with a strong Python experience these messages read rather harsh to me, e.g. like an AttributeError or IndexError that would cause a Python interpreter to halt.

My questions are:

  1. Am I too worried about the messages, are these acceptable in the PHP domain / wider developer community?
  2. If so, how should I configure the PHP interpreter to filter out non-harmful error messages?
webhostname nginx: 2023/10/17 11:27:36 [error] 834#834: *8705 FastCGI sent in stderr: "PHP message: PHP Warning:  Undefined array key "modifier" in /var/www/html/webrootfolder/cache/templates/256a29127060783644bfb37fe274453c8ba4ce2c_0.file.main.tpl.php on line 52PHP message: PHP Warning:  Trying to access array offset on value of type null in /var/www/html/webrootfolder/cache/templates/256a29127060783644bfb37fe274453c8ba4ce2c_0.file.main.tpl.php on line 52PHP message: PHP Warning:  Trying to access array offset on value of type null in /var/www/html/webrootfolder/cache/templates/256a29127060783644bfb37fe274453c8ba4ce2c_0.file.main.tpl.php on line 52PHP message: PHP Fatal error:  Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, no array or string given in /var/www/html/webrootfolder/cache/templates/256a29127060783644bfb37fe274453c8ba4ce2c_0.file.main.tpl.php:52
Stack trace:
#0 /var/www/html/webrootfolder/libs/sysplugins/smarty_template_resource_base.php(123): content_650af2c756a474_07645705()
#1 /var/www/html/webrootfolder/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode()
#2 /var/www/html/webrootfolder/libs/sysplugins/smarty_internal_template.php(217): Smarty_Template_Compiled->render()
#3 /var/www/html/webrootfolder/libs/sysplugins/smarty_internal_template.php(386): Smarty_Internal_Template->render()
#4 /var/www/html/webrootfolder/libs/sysplugins/smarty_internal_runtime_inheritance.php(116): Smarty_Internal_Template->_subTemplateRender()
#5 /var/www/html/www.matte" while reading response header from upstream, client: 1.2.3.4, server: webrootfolder, request: "GET /apple-touch-icon-precomposed.png HTTP/2.0", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "www.domain.org"


webhostname nginx: 2023/10/17 11:15:02 [error] 834#834: *8066 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Array and string offset access syntax with curly braces is no longer supported in /var/www/html/webrootfolder/libs/icalcreator/src/Util/Util.php on line 974" while reading response header from upstream, client: 1.2.3.4, server: www.domain.org, request: "GET /resource.ics HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "webrootfolder", referrer: "…"


webhostname nginx: 2023/10/17 11:01:41 [error] 834#834: *7670 FastCGI sent in stderr: "PHP message: PHP Warning:  Undefined property: stdClass::$ogImage in /var/www/html/webrootfolder/controllers/show_show.inc.php on line 58" while reading response header from upstream, client: 1.2.3.4, server: www.domain.org, request: "GET /resource.html HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "www.domain.org"


webhostname nginx: 2023/10/17 10:05:55 [error] 834#834: *6052 FastCGI sent in stderr: "PHP message: PHP Warning:  Attempt to read property "embed" on bool in /var/www/html/webrootfolder/cache/templates/db7e5f92d02757ec0c1373f5e06f2329b5e7f84f_0.file.element_block_video.tpl.php on line 26" while reading response header from upstream, client: 1.2.3.4, server: www.domain.org, request: "GET /path/?preview HTTP/1.1", upstream: "fastcgi://unix:/run/php/php-fpm.sock:", host: "www.domain.org"

WooCommerce – wc_create_refund – get_shipping_country

I’m setting up a reseller store and developing a hook that sends a request off to an API to purchase the product, if the API is broken or the product is out of stock I’d like the customer refunded automatically.

I’m running into an issue with wc_create_refund, note that when you place an order I don’t ask for address information as it’s not required for my store and I currently don’t calculate tax. I get the following fatal error when running the function –

[17-Oct-2023 09:28:39 UTC] PHP Fatal error:  Uncaught Error: Call to undefined method WC_Order_Refund::get_shipping_country() in D:wamp64wwwwp-contentpluginswoocommerceincludesabstractsabstract-wc-order.php:1660
Stack trace:
#0 D:wamp64wwwwp-contentpluginswoocommerceincludesabstractsabstract-wc-order.php(1747): WC_Abstract_Order->get_tax_location(Array)
#1 D:wamp64wwwwp-contentpluginswoocommerceincludesabstractsabstract-wc-order.php(1921): WC_Abstract_Order->calculate_taxes()
#2 D:wamp64wwwwp-contentthemeswoodmart-childtestorder.php(162): WC_Abstract_Order->calculate_totals()
#3 D:wamp64wwwwp-contentthemeswoodmart-childtestorder.php(92): refund_user_for_failed_order(Object(WC_Product_Simple), Array, 32097)
#4 D:wamp64wwwwp-contentthemeswoodmart-childtestorder.php(345): create_api_order(32097)
#5 {main}
  thrown in D:wamp64wwwwp-contentpluginswoocommerceincludesabstractsabstract-wc-order.php on line 1660

Here’s my function

// Refund Function
function refund_user_for_failed_order($product, $response, $order_id) {
    // Get the product price for the refund amount (adjust this based on your pricing structure)
    $refund_amount = $product->get_price();
    error_log('Refund Amount: ' . $refund_amount);
    error_log('Product Price: ' . $product->get_price());

    // Get the user associated with the order (you may need to customize this part)
    $user_id = get_current_user_id(); // For demonstration purposes, assuming the current user is the buyer

    // Provide default shipping details for digital products
    $default_shipping_data = array(
        'country' => 'AU', // Provide the appropriate country code
        'state' => 'NSW', // Provide the appropriate state code
        'postcode' => '2000', // Provide the appropriate postcode
        'city' => 'Sydney', // Provide the appropriate city
    );

    // Check if the user is eligible for a refund (you may have specific refund policies)
    if ($user_id && $refund_amount > 0) {
        // Load the original order
        $order = wc_get_order($order_id);

        // Create a refund request
        $refund = wc_create_refund(
            array(
                'amount' => $refund_amount,
                'reason' => 'Failed eSIM order', // Customize this reason
                'order_id' => $order_id, // Use the product's parent order ID
                'line_items' => array(
                    array(
                        'product_id' => $product->get_id(),
                        'variation_id' => 0, // Assuming no variation
                        'quantity' => 1,
                    ),
                ),
                'shipping' => $default_shipping_data, // Provide default shipping data
            )
        );

        // Check if the refund was created successfully
        if (is_wp_error($refund)) {
            // Handle the error, log it and notify the administrator
            error_log('Failed to create refund: ' . $refund->get_error_message());
            echo 'An error has occured and you will be refunded for this order - Website admins have been notified.';          
            // Send an email to [email protected]
            $subject = 'Refund Un-Successful';
            $message = 'Refund Un-Successful for Product Id ' . $product->get_id();
            send_email('[email protected]', $subject, $message);            
        } else {
            // Process the refund
            $refund->calculate_totals(); // Calculate totals
            $refund->refund(); // Perform the refund
            echo 'An error has occured and you will be refunded for this order - Website admins have been notified.';

            // notify the administrator about a successful refund
            error_log('Refund successful for product ID: ' . $product->get_id());
            // Send an email to [email protected]
            $subject = 'Refund Successful';
            $message = 'Refund Successful for Product Id ' . $product->get_id();
            send_email('[email protected]', $subject, $message);
        }
    }
}

It actually processes the refund, I just get this nasty error that I’d like to somehow bypass,

Thanks!

I’ve tried to specify dummy shipping data, this didn’t change anything and I’ve tried to specify tax to be 0 but it’s a protected method.

Difficulty Fetching Instagram Profile and Posts via API – Seeking Alternative Solutions

I have been attempting to retrieve Instagram profiles and their respective posts using the Instagram Basic API for IG Champ. Unfortunately, it seems that this method is no longer effective. Is there anyone who can provide insights or suggest alternative approaches to achieve this? Your assistance in this matter would be greatly appreciated.

I try instagram api and Instagram scrapping using PHP.

How do I write Dockerfile for PHP image and PostgreSQL driver

How do I write Dockerfile for PHP image and PostgreSQL driver?

I wrote a Dockerfile but it threw an error.

My Dockerfile (I refer to https://gist.github.com/ben-albon/3c33628662dcd4120bf4)

FROM php:8.2-apache-buster

RUN apt-get update && apt-get install -y libpq-dev && docker-php-ext-install pdo pdo_pgsql

COPY . /var/www/html

My docker-compose.yml (There is a separate PostgreSQL’s docker-compose.yml)

version: "3"

services:
  php:
    build: .
    ports:
      - 9999:80

The error

Fatal error: Uncaught Error: Call to undefined function pg_connect() in /var/www/html/db.php:7 Stack trace: #0 /var/www/html/inc/header.php(2): require_once() #1 /var/www/html/index.php(14): require_once(‘/var/www/html/i…’) #2 {main} thrown in /var/www/html/db.php on line 7

How to rewrite a js file in .htaccess

I want to count the number of requests to a file via a rewrite to a php script. I am using the following code in the .htaccess file for this redirect:

Option 1:

RewriteEngine On  
RewriteBase / 
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_URI} test.js$ [NC]
RewriteRule ^ /handler.php?filename=%{REQUEST_FILENAME} [L]

Option 2:

RewriteEngine On  
RewriteBase / 
RewriteRule (.*test.js$) /handler.php?filename=$1 [L]

But this redirection doesn’t happen, it outputs the normal contents of the test.js file, without involving the handler.php file

WordPress database error: [Table ‘wp_users’ already exists]

I cant accsess the wordpress website that I’ve already submitted on my localhost

Although I have already submitted the website I cant access it with “http://localhost/saargolpurmohamad.ir” and it redirects me to the installation page, when I fill it out I get “WordPress database error: [Table ‘wp_users’ already exists]”.
How can I accsess my website again?

My PHP is not working for my school assignment how do I fix it? [duplicate]

 
               <!DOCTYPE html>
                <html>
                
                <!--Title-->
                
                <title>Saint Services</title>
                
                <!--Links-->
                
                <link rel="stylesheet" href="style.css">
                
                <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4bw+/aepP/YC94hEpVNVgiZdgIC5+VKNBQNGCHeKRQN+PtmoHDEXuppvnDJzQIu9" crossorigin="anonymous">
                
                <script src="code.js"></script>
                
                </head>
                <body>
                <header class="nav">
                    <div class="mb-4 logo">
                        <logo><img src="imageslogo-sac.png" width="50" length="50" alt="logo"></logo>
                    </div>
                    <div class="home">
                        <links><a href="test.html"><img src="imageshome.png" width="75" length="75" alt="home"></a></links>
                    </div>
                    <div class="settings">
                        <links><a href="style.css"><img src="imagescog.png" width="75" length="75" alt="settings"></a></links>
                    </div>
                    <div class="profile">
                        <links><a href="login.php"><img src="imagesperson.png" width="75" length="75" alt="person"></a></links>
                    </div>
                    <div class="donations">
                        <links><a href="donate.php"><img src="imagesdonate.png" width="75" length="75" alt="donations"></a></links>
                    </div>
                
                </header>
                <br>
                <div class="section">
                    <div class="container">
                        <div class="row full-height justify-content-center">
                            <div class="col-12 text-center align-self-center py-5">
                                <div class="section pb-5 pt-5 pt-sm-2 text-center">
                                    <h6 class="text"><span>Log In </span><span>Sign Up</span></h6>
                                      <input class="checkbox" type="checkbox" id="reg-log" name="reg-log"/>
                                      <label for="reg-log"></label>
                                    <div class="card-3d-wrap mx-auto">
                                        <div class="card-3d-wrapper">
                                            <div class="card-front">
                                                <div class="center-wrap">
                                                    <div class="section text-center">
                                                        <form action="login.php" method="post">
                                                        <text><h4 class="text mb-4 pb-3">LOG IN</h4></text>
                                                        <div class="form-group">
                                                            <input type="email" name="EMAIL" class="form-style" placeholder="*Email" id="logemail" autocomplete="off">
                                                            <i class="input-icon uil uil-at"></i>
                                                        </div>  
                                                        <div class="form-group mt-2">
                                                            <input type="password" name="PASSWORD" class="form-style" placeholder="*Password" id="logpass" autocomplete="off">
                                                            <i class="input-icon uil uil-lock-alt"></i>
                                                        </div>
                                                        <a type="submit" href="donate.php" class="btn mt-4">SUBMIT</a>
                                                        <p class="mb-0 mt-4 text-center"><a href="" class="link">Forgot your password?</a></p>
                                                      </div>
                                                  </div>
                                              </div>
                                            <div class="card-back">
                                                <div class="center-wrap">
                                                    <div class="section text-center">
                                                        <text><h4 class="text">SIGN UP</h4></text>
                                                        <form action="test.php" method="post">
                                                        <div class="form-group">
                                                            <input type="text" name="FIRST_NAME" class="form-style" placeholder="*First Name" id="FIRST_NAME" autocomplete="off">
                                                            <i class="input-icon uil uil-user"></i>
                                                        </div>
                                                        <div class="form-group mt-2">
                                                            <input type="text" name="SURNAME" class="form-style" placeholder="*Surname" id="SURNAME" autocomplete="off">
                                                            <i class="input-icon uil uil-user"></i>
                                                        </div>
                                                        <div class="form-group mt-2">
                                                            <input type="text" name="MOBILE_NUMBER" class="form-style" placeholder="*Phone Number" id="MOBILE_NUMBER" autocomplete="off">
                                                            <i class="input-icon uil uil-user"></i>
                                                        </div>  
                                                        <div class="form-group mt-2">
                                                            <input type="email" name="EMAIL" class="form-style" placeholder="*Email" id="EMAIL" autocomplete="off">
                                                            <i class="input-icon uil uil-at"></i>
                                                        </div>  
                                                        <div class="form-group mt-2">
                                                            <input type="password" name="PASSWORDS" class="form-style" placeholder="*Password" id="PASSWORDS" autocomplete="off">
                                                            <i class="input-icon uil uil-lock-alt"></i>
                                                        </div>
                                                        <div class="form-group mt-2">
                                                            <input type="password" name="CONFIRM_PASSWORD" class="form-style" placeholder="*Confirm Password" id="CONFIRM_PASSWORD" autocomplete="off">
                                                            <i class="input-icon uil uil-lock-alt"></i>
                                                        </div>  
                                                        <a type="submit" class="btn mt-4" onclick="return signinValid()">SUBMIT</a>
                                                        </form>
                                                      </div>
                                                  </div>
                                              </div>
                                          </div>
                                      </div>
                                  </div>
                              </div>
                          </div>
                    </div>
                </div>
                </body>
                <footer>
                <div class="mb-4 logo">
                    <logo><img src="imageslogo-sac.png" width="50" length="50" alt="logo"></logo>
                    <p>Name</p>
                </div>
                    
                <?php
                
                //PHP
                
                //Connection to database
                require("login.php");
                
                //Signup
                $conn = new mysqli("localhost","admin","30:]thrib#day*01$2007","fa3") or die(mysqli_error($conn));
                
                if(isset($_POST["submit"])){
                
                $fname = $_POST["FIRST_NAME"];
                $lname = $_POST["SURNAME"];
                $mobile = $_POST["MOBILE_NUMBER"];
                $email = $_POST["EMAIL"];
                $pass = $_POST["PASSWORDS"];
                $cpass = $_POST["CONFIRM_PASSWORD"];
                
                }
                
                $query = mysqli_query($conn,"INSERT INTO users VALUES(FIRST_NAME, SURNAME, MOBILE_NUMBER, EMAIL, PASSWORDS, CONFIRM_PASSWORDS)
                VALUES($fname, $lname, $mobile, $email, $pass, $cpass)") or die(mysqli_error($conn));
                
                //Login
                ?>
                

The code reads the variables $fname, $lname, $mobile, $pass, $cpass as undefined in my variable then I get a fatal error. The php is on another page called test.php. My teacher recommended putting it on two different pages to make sure php is not ‘confused’. I don’t care about validation as I used my Javascript for that. This my last resort and it is due tommorrow.

Warning: Undefined variable $fname in C:xampphtdocsdstest.php on line 23

Warning: Undefined variable $lname in C:xampphtdocsdstest.php on line 23

Warning: Undefined variable $mobile in C:xampphtdocsdstest.php on line 23

Warning: Undefined variable $email in C:xampphtdocsdstest.php on line 23

Warning: Undefined variable $pass in C:xampphtdocsdstest.php on line 23

Warning: Undefined variable $cpass in C:xampphtdocsdstest.php on line 23

Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘VALUES(, , , , , )’ at line 2 in C:xampphtdocsdstest.php:22 Stack trace: #0 C:xampphtdocsdstest.php(22): mysqli_query(Object(mysqli), ‘INSERT INTO use…’) #1 {main} thrown in C:xampphtdocsdstest.php on line 22