• Hi,
    I’m an absolute beginner in PHP, WordPress. In my page I need to:
    1. input name or/and select country and city (ajax_select_city.js)
    2. click search button
    3. result is a table, I add one plus update button in every column; the mobile and email columns are editable
    4. I can’t realize:
    Ex. I change a mobile number and when I click to change button I want to execute update script in MySQL. I try onclick method but I can’t do it (button value equal UPDATE part).

    Thanks for answers.

    WordPress main page:

    [php_include] include '/select_list_city.php'; [/php_include]
    <html>
        <head>
            <meta charset="utf-8" /><script src="/ajax_select_city.js" type="text/javascript"></script>
        </head>
        <body>
            <form id="myForm" action="/userlnfo-modify.php" method="post">
                Név*:<br><input type="text" name="nev">
                <p> [php_include] echo $re_html;[/php_include]<br class="clear" />
                <br class="clear" />
                <button id="sub">Search</button>
                <br><br></form><span id="result"></span>
                <div id="data"><?php echo $result; ?></div>
                <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.1.min.js"></script>
                <script src="/my_script.js" type="text/javascript"></script>
            </Form>
        </body>
    </html>

    This is a part of userlnfo-modify.php:

    while ($data = mysqli_fetch_array($query))
    {
        $ID = $ID+1;
        $data_name = $data["name"];
    
        echo'
        <tr style="background-color:#EFFBFB; border: 1px solid black;">
        <td style="font-size:14px;">'.$data["name"].'</td>
        <td style="font-size:14px;">'.$data["city"].'</td>
        <td style="font-size:14px;">'.$data["age"].'</td>
        <td style="font-size:14px;">'.$data["utca"].'</td>
        <td><input type="text" value='.$data["mobil"].'></td>
        <td><input type="text" value='.$data["email"].'></td>
        <strong><td onclick="cellOnclick()"><a href="#" onclick="linkOnclick()" style="text-decoration: none;">
        <input type=button value="UPDATE" myFunction(this);return false;"></button></td></tr>';</strong>
    }
    echo '</table>';
    }
    
    unset all variable...

The topic ‘Can't run update script in PHP returned table’ is closed to new replies.