building control structures

So I need to build a control structure where the default behavior causes the provided web page to be delivered to the client’s browser.

I need to do it in this index.php file:

<?php if (isset($_POST['submit'])){ $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $url = $_POST['url']; $email = $_POST['email']; $inputs = array('firstname'=>$firstname, 'lastname'=>$lastname, 'url'=>$url, 'email'=>$email); include 'view.php'; exit; } else { include 'view.php'; exit; } ?>

I’m unsure what the question actually is.

Use ’ ’ to ensure the variables are set if user inputs spaces
$inputs = array(‘firstname’=>’$firstname’, ‘lastname’=>’$lastname’, ‘url’=>’$url’, ‘email’=>’$email’);

You will also want to escape any special characters etc from the input variables

And your issue is? You collect the post data , but don’t use it. Should you be?

Also, you check to see if the form is posted, then retrieve the posted inputs.
But, then, you go to view.php no matter if data was posted or not. That logic is not correct.

We do not see the view.php file listed, therefore we can not help you fix it.

Lastly, please place your code inside of tags using the PHP button next time. Thanks.

Give us more info on what you want help with…

Sponsor our Newsletter | Privacy Policy | Terms of Service