How can the logic in the PHP script be improved to achieve the desired outcome?
Issue: The current PHP script is using the assignment operator "=" instead of the comparison operator "==" in the if statement, which is causing the condition to always evaluate to true. To achieve the desired outcome, we need to use the comparison operator "==" to check if the user input matches the predefined value.
// Incorrect logic
$user_input = $_POST['user_input'];
if($user_input = "hello") {
echo "Welcome!";
} else {
echo "Access denied";
}
```
```php
// Corrected logic
$user_input = $_POST['user_input'];
if($user_input == "hello") {
echo "Welcome!";
} else {
echo "Access denied";
}