Rob Alston Rob Alston - 5 months ago 8
PHP Question

why is my textbox not populating?

I have removed all other code trying to find my error. The code below will echo the passed value/variable in the php portion of the code only in line 2 which verifies that the variable is being passed. The textbox in the html portion renmains blank and does not populate. Probably something simple that I am missing, but going crazy trying to find the error. Please tell me what I have done wrong?



<?php
echo $new_customer . $_POST['search'];
?>

<!doctype html>
<html lang="en">
<body>
<input type="text" name="customer_name" value="<?php echo $new_customer; ?>" id="customer_name">
</body>
</html>




Answer

you need value for $new_customer.

<?php
$new_customer =  $_POST[search];
?>

Unless you assign value to $new_customer you can't print it in html.

Comments