Thursday, October 27, 2022
HomeWordPress DevelopmentDeadly error: Uncaught Error: trim(): Argument #1 ($string) at wp-includesclass-wp-query.php

Deadly error: Uncaught Error: trim(): Argument #1 ($string) at wp-includesclass-wp-query.php


I’m utilizing a type to submit desk inserted values utilizing <enter title=[]> as $_POST to a PHP web page. It is a template web page of wordpress and I get an error.

<?php
/*
Template Identify: desk web page
*/
get_header();
world $wpdb;
$names= $wpdb-> get_results('choose stdName FROM wp_nis_student');
?>
<type motion="" technique="submit" >
 <desk>
        <thead>
            <tr>
                <th>Scholar Identify</th>
                <th>English</th>
                <th>Maths</th>
            </tr>
        </thead>
        <tbody>

            <?php foreach($names as $title ){?>
                <tr>
                  <td><enter kind="textual content" title="title[]" worth="<?php echo $name->stdName;>"/</td>
                  <td><enter kind="textual content" title="Engmark[]"/></td>
                  <td><enter kind="textual content" title="Mathmark[]"/></td>
                </tr>
                <?php }?>
        </tbody>
    </desk> 
    <button  kind="submit" title="submit" worth="Submit">Submit</button>
</type>
<?php
if(isset($_POST['submit'])){
    if(isset($_POST['name'])&& isset($_POST['Engmark']) && isset($_POST['Mathmark'])){
         echo "Names: <br/>";
            foreach ( $_POST["name"] as $title ) 
              echo $title . "<br/>";
            echo "<br/><br/>" .
                 "English : <br/>";
            foreach ( $_POST["Engmark"] as $eng ) 
              echo $eng . "<br/>";

              echo "<br/><br/>" .
                 "Maths: <br/>";
            foreach ( $_POST["Mathmark"] as $mat ) 
              echo $mat . "<br/>";
          }
     else echo "Error: no knowledge";
        }
?>

And I get this error as a result of am calling isset($_POST[‘submit’])

Deadly error: Uncaught Error: trim(): Argument #1 ($string) should be of
kind string, array given in ..wp-includesclass-wp-query.php on line
811

Then a made change on the line 811 in class-wp-query.php $qv[‘name’] = trim( $qv[‘name’] ); to $qv[‘name’] = trim( $qv[‘name[]’] ); it labored positive however i begin getting warning on the web site

Warning: Undefined array key "title[]" in ..wp-includesclass-wp-query.php on line 811

How can I resolve it?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments