Hello all,
I am trying to set a variable that can come from one of two places. Either a form or from a mysql select.
I’ve tried the below but i a blank variable if the form data is blank but it has the correct data if the form data is set. I think it’s because I am defining the variable twice even though it’s within an if statement
I have trimmed out the extra code. It correctly pulls the data out of the DB if I don’t have the if statement but with it
while($row = $result->fetch_assoc()) {
if(isset($_POST['carreg'])){
$carreg = $_POST['carreg'];
}else{
$carreg = $row['carreg'];
}
}
Any help would really be appreciated, I am sure it’s something simple
Summary
This text will be hidden