I'm wondering if some more experienced PHP coders can help me resolve this issue:
- I have a edit.php page which displays current client data to update in form fields.
- the update button that when clicked at the moment is just going to a page clients.php (Showing all clients data including the updated client data)
- My goal is when the update button is clicked instead of going to clients.php as a redirect and showing a table full of clients, i wish it to redirect to just the individual client info on the report.php page and have it echo the current updated client data in a table.
All i get is a syntax error below.
syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING)
Below is the redirect code on the edit.php page, then below that the reports.php page i want to redirect to but only echo current Client ID's data.
if($run_update){
header("Location: reports.php?cus_id=<?php echo $result['id'] ?>");
keepmsg('<div class="alert alert-success text-center">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<strong>Success!</strong> Client updated successfully.
</div>');
} else {
keepmsg('<div class="alert alert-danger text-center">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<strong>Sorry!</strong> Client could not be updated.
</div>');
}
Below is the simple reports.php page. This is were I'm trying to redirect to and display only the current clients data by ID
<div class="container">
<div class="jumbotron">
<div class="container">
<div class="row">
<div class="col-md-12">
<small class="pull-right"><a href="edit.php?cus_id=<?php echo $row['id'] ?>" class='btn btn-danger'>Edit Client</a> </small>
<h2 class="text-center invert"> Client Info: <span class="font-weight-light"><?php echo $row['deceased'] ?></span></h2>
<hr>
</div>
</div>
</div>
<br>
<div class="table-responsive table-wrapper">
<table class="table table-bordered table-hover text-center">
<thead>
<tr>
<th class="text-center">Job Type</th>
<th class="text-center">Name of Deceased</th>
<th class="text-center">Plot Number</th>
<th class="text-center">Cemetery</th>
</tr>
</thead>
<tbody class="invert_td">
<tr>
<td><?php echo $row['jobtype'] ?></td>
<td><?php echo $row['deceased'] ?></td>
<td><?php echo $row['plot'] ?></td>
<td><?php echo $row['cemetery'] ?></td>
</tr>
</tbody>
</table>
</div>
</div>
Below if the 1st line of code from my form on the edit.php page if that helps
<form class="form-horizontal" role="form" method="post" action="edit.php?cus_id=<?php echo $client_id ?>">