Click here to Skip to main content
15,891,253 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I can't figure out how to define the updateid variable so my edit button will load it on my edit page. When I click the edit button created below it goes to my edit page but instead of having the numeric value of the updateID it literally says updateID. I need to figure out how to declare the updateID variable so that it will grab it from the current form and load it on the following edit form. The value that needs to be the updateID value is the "contactsEntryNumber" field.

Here is my code for my sql statement:

PHP
$contactSql = "SELECT * FROM `Tickets` as t
          JOIN Contacts as co ON t.CustomerID=co.ContactId
           WHERE t.TicketNumber ='$ticketNumber'
"
;

$contactResult = $conn->query($contactSql);
//echo "<pre>";print_r($contactResult);die;
if ($contactResult->num_rows > 0) {

    $contactRow = $contactResult->fetch_all(MYSQLI_ASSOC);

}


Here is my code for my table with my failed effort to declare the variable:

<table id="Customer_Contacts" class="table table-bordered" style="color:#F46813 ;border-color:#F46813;border:1px">
    <thead class="thead-dark">
    <th >Selected</th>
    <th>Name</th>
    <th>Phone Main</th>
    <th>Phone Mobile</th>
    <th>Phone Home</th>
    <th>Email</th>
    </thead>

    <?php
      $contactsEntryNumber= ['ContactsEntryNumber'];

    foreach ($contactRow as $key=>$value){?>
        <tr>
            <td><?php if($value['Select'] =='-1'){?>
                    class="fa fa-check-circle-o">
                <?php }?></td>
            <td><?=(($value['ContactLast'] !='') ? $value['ContactFirst'].' '.$value['ContactLast'] :'')?></td>
            <td><?=(($value['PhoneMain'] !='') ? $value['PhoneMain'] :'')?></td>
            <td><?=(($value['PhoneMobile'] !='') ? $value['PhoneMobile'] :'')?></td>
            <td><?=(($value['PhoneHome'] !='') ? $value['PhoneHome'] :'')?></td>
            <td><?=(($value['Email'] !='') ? $value['Email'] :'')?></td>
          <td><button class=\"btn btn-primary btn-sm\"><a href=\"contacts_edit.php?updateid=$contactsEntryNumber\" class=\"text-light\">EDIT</a></button></td>
        </tr>
    <?php }?>
</table>


What I have tried:

A lot of things lol and I just don't know enough about PHP yet to see where my error is.
Posted
Updated 3-Apr-22 5:09am
v3
Comments
Richard MacCutchan 3-Apr-22 3:31am    
You have not explained what the problem is.
Fireytech Accounting 3-Apr-22 14:45pm    
I updated my question. Let me know if that helps.
Richard MacCutchan 4-Apr-22 5:10am    
As far as I can see the line that creates the button is not inside proper PHP tags.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900