-1

I am trying to make a AJAX code with PHP.

Main PHP code is here.

And supporting PHP code (which load with AJAX every time) is here.

AJAX is loaded perfectly.

But it is not loaded perfectly.

What AJAX is supposed to do is giving this type of code every time -

                <tr>
                    <form action="update" method="post">
                        <th nowrap=""><?php echo '<a href="profile/'.$row_list['vanity_url'].'" target="_new">'.substr($row_list['name'],0,15).'</a>'; ?></th>
                        <th ><input type="text" readonly value='<?php echo $row_list['vanity_url']; ?>' class="login-text name right10 form-control" style="width: 600px" id="registerCompany" name="old"></th>
                        <th nowrap=""><br/></th>
                        <th ><input type="text" class="login-text name right10 form-control" style="width: 600px" id="registerCompany" name="new" placeholder="*New URL" required autocomplete="off" ></th>
                        <th nowrap=""><br/></th>
                        <th nowrap=""><button type="submit" class="btn btn-primary">Update</button></th>
                    </form>
                </tr>

But it is not giving this. It is giving

                 <tr>
                    <form action="update" method="post"></form>
                        <th nowrap=""><?php echo '<a href="profile/'.$row_list['vanity_url'].'" target="_new">'.substr($row_list['name'],0,15).'</a>'; ?></th>
                        <th ><input type="text" readonly value='<?php echo $row_list['vanity_url']; ?>' class="login-text name right10 form-control" style="width: 600px" id="registerCompany" name="old"></th>
                        <th nowrap=""><br/></th>
                        <th ><input type="text" class="login-text name right10 form-control" style="width: 600px" id="registerCompany" name="new" placeholder="*New URL" required autocomplete="off" ></th>
                        <th nowrap=""><br/></th>
                        <th nowrap=""><button type="submit" class="btn btn-primary">Update</button></th>
                </tr>

So, the form is closed, so it can't be used.

Can anyone help me, please?

Thanks in advance for helping.

Abrar Jahin
  • 13,970
  • 24
  • 112
  • 161
  • Your returned HTML is not valid. check this answer http://stackoverflow.com/questions/1249688/html-is-it-possible-to-have-a-form-tag-in-each-table-row-in-a-xhtml-valid-way – Brisc Bogdan Dec 03 '14 at 19:37

1 Answers1

0

Try using this code

while($row_list=mysqli_fetch_array($query))
        { ?>
            <tr>
                <td>
                    <form action="update" method="post">
                        <table style="width:100%">
                            <tr>
                                <td nowrap="">  <?php echo '<a href="profile/'.$row_list['vanity_url'].'" target="_new">'.substr($row_list['name'],0,15).'</a>'; ?> </td>
                                <td>            <input type="text" readonly value='<?php echo $row_list['vanity_url']; ?>' class="login-text name right10 form-control" style="width: 600px" id="registerCompany" name="old">   </td>
                                <td>            <input type="text" class="login-text name right10 form-control" style="width: 600px" id="registerCompany" name="new" placeholder="*New URL" required autocomplete="off" >   </td>       
                                <td nowrap="">  <button type="submit" class="btn btn-primary">Update</button>       </td>
                            </tr>
                        </table>
                    </form>
                </td>
            </tr>
<?php   }

Think it will be solved.

Abrar Jahin
  • 13,970
  • 24
  • 112
  • 161