Upload
planning-ness
View
5.373
Download
2
Embed Size (px)
DESCRIPTION
Noah Brier's presentation at Planning-ness 2010
Citation preview
But how do you do it?
How do you take what someone types in and build something to respond to it?
14
Let’s talk about HTTP
“HTTP functions as a request-response protocol in the client-server computing model.”
15
24
ÜííéWLLïïïKÖooÖäÉKÅoãLëÉ~êÅÜ\èZé~ëëáåÖHÇ~í~HÑêoãHoåÉHé~ÖÉHíoH~åoíÜÉêCÄíådZdooÖäÉHpÉ~êÅÜC~èZÑCoèZ
25
ÜííéWLLïïïKÖooÖäÉKÅoãLëÉ~êÅÜ\èZé~ëëáåÖHÇ~í~HÑêoãHoåÉHé~ÖÉHíoH~åoíÜÉêCÄíådZdooÖäÉHpÉ~êÅÜC~èZÑCoèZ
26
search?q=passing+data+from+one+page+to+another
1. search2. ?3. q=4. passing+data+from+one+page+to+another
27
search?q=passing+data+from+one+page+to+another
1. search (page that is processing the data)2. ? (start of query string)3. q= (field name)4. passing+data+from+one+page+to+another (query)
So the very easiest way to pass data between pages
Is by putting it in the URL. You already do this, you just don’t realize it.
29
31
ÜííéWLLïïïKÜoïãìÅÜÇoÉëáíÄìóKÅoãLÅoëíëKéÜé\ïÜ~íZ~PUMCãoåÉóZTUTHÄáääáoå
36
<form method=“get” action=“webapp.php”> <input type=“text” name=“stuff”> <input type=“submit”></form>
<form method=“get” action=“webapp.php”> <input type=“text” name=“stuff”> <input type=“submit”></form>
37
HTTP request method(passed in URL)
Page that will process our request
Name input will be saved under
<form method=“get” action=“webapp.php”> <input type=“text” name=“stuff”> <input type=“submit”></form>
38
HTTP request method(passed in URL)
Page that will process our request
Name input will be saved under
webapp.php?stuff=WHATEVERPEOPLETYPEIN
41
ÜííéWLLóoìêÇoã~áåKÅoãLãóÑáêëíïÉÄ~ééLïÉÄ~ééKéÜé\ëíìÑÑZëïÉÉíåÉëë
42
Now we just need to figure out how to get stuff down
At this point we turn to our trusty language of choice.
Every language has its own syntax for this stuff
We’re going to be using PHP because that’s what I know.
45
POST is generally used for data you’re going to save.
But for now let’s just think of it as data you don’t want to show up in a URL.
56
58
<form method=“post” action=“checkpassword.php”> Password: <input type=“password” name=“password”> <input type=“submit”></form>
62
<?if($_POST['password'] == 'password1') { print 'AWESOMECAKE!';} else {?> You got the password wrong, try again.<br />
<form method="post" action="checkpassword.php"> Password: <input type="password" name="password"> <input type="submit"> </form><?}?>
Download These
MAMP: http://www.mamp.info/en/downloads/index.html
TextWrangler: http://www.barebones.com/products/textwrangler/download.html
Code: http://noahbrier.com/planningness.zip
OR YOU COULD GO TO http://noahbrier.com/planningness
85