Treehouse PHP into Flashcards
php needs a .php extension to operate and wont work in a html ext
true
a simple synatx error may cause the entire page not to load
t
how to include in php
include(‘includes/header.php);
php variables start with what
$
to specify where a form posts its data you can add what to the form element
action=”action-process.php”
this woulld then load that .php file after submitting giving you access to the vars
what does var_dump do in php
shows all accesible variables in an array
you can then access a variable from within it like such
var_dump($_POST);
$name = $_POST[“name”];
in a form element, what keyword specifies if its a post form
method=”post”
in php after submitting a form, a good practice is to redirect them to a different page than the submission complete .php fpage; how can we do this
at the end of the submission php page use the function header(“Location: page-thanks.php”);
in php how can we check if the server is performing a get or a post or w/e
$_SERVER[“REQUEST_METHOD”]
where are get variables set in a url
?var&var2 etc
what is the PHP keyword to retrieve the get message
$_GET[“status”]
in php how to check is a variable is set
isset (best used in an if statement to check if _getstatus is there, and then check if the value is equal to something using th and operator
how to create an array in php
array=(1,2,3);
in php echo a single array element
echo array[0];
in php how to find the number of elements in an array
count(array)