AH PHP/HTML Flashcards
When asked about an HTML form input, what two things methods are there?
POST
GET
When using the form tag, what 3 pieces of info do you need?
method (post/get)
action (php file)
name (filename)
When using the input tag with input boxes, what 2 pieces of info do you need?
Type (text/password/date)
Name (what the box is called)
When using the input tag with a submit button what 3 pieces of info do you need?
Type (submit)
Value (Submit Form)
Name (what it’s called (submit))
To connect to a database server what 3 connection parameter do you need?
$dbserver = ... $dbuser = ... $dbpass = ...
To connect and select a database what 2 lines do you need?
$connection = mysql_connect($dbserver, $dbuser, $dbpass);
mysql_select_db($database, $connection);
What 2 lines of code do you need when assigning HTML user and pass to server side-variables?
$user = $_POST['username']; $userpassword = $_POST['userpassword'];
What 2 lines of code would you need to add data to a table?
$sql = “INSERT INTO … VALUES(‘…’)”;
mysql_query($sql);
What 1 line of code would you need to close a database connection?
mysql_close($connection)
What line of code would you need to update a piece of data in a database? Use pseudocode
SET query TO “UPDATE tablename SET field1 = … where field2 = …