Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

PHP記帳網頁教材(第一頁是空白的)

1,620 views

Published on

極短時間體驗從0寫出一個記帳網頁。使用PHP、HTML、CSS、SQL。

Published in: Education
  • Be the first to comment

PHP記帳網頁教材(第一頁是空白的)

  1. 1. 1. HTML ( ) 2. PHP ( ) 3. CSS ( )
  2. 2. • C/C++( ) • Java( ) • JavaScript( ) • PHP( ) • Python( , ) • Ruby • C#( ) • Objective-C( iphone, MAC )
  3. 3. http://www.darkthread.net/photos/2583-5a03-o.png
  4. 4. Sublime Text 3 https://www.sublimetext.com/3
  5. 5. Sublime Text 3 • Package Control ( ) • Emmet ( !) http://blog.miniasp.com/post/2014/01/06/Useful-tool-Sublime-Text-3-Quick-Start.aspx
  6. 6. HTML • HTML • • <> ( )
  7. 7. HyperText Markup Language • Hypertext: • Markup
  8. 8. HTML • < > (tag) • < > . • tag <html> tag </html> • <A> <B> </B>
 </A>
 <C> </C>
  9. 9. HTML
  10. 10. index.html body title
  11. 11. HTML http://www.w3schools.com/html/html_form_input_types.asp
  12. 12. form( ) <form action=“ PHP " method="GET"> <input type="text" name=“my_name"> <input type="password" name="pwd"> <input type="submit" value="Submit"> </form> POST
  13. 13. form
  14. 14. 3 • • •
  15. 15. PHP • $ ex: $a • ex: $b • ex: $a $A • $I_love_you $Taiwan_no_1
  16. 16. PHP $a = 3; // ( ) $b = $a + 4; // b = 7 echo $b; //7 $c = “This is PHP course.”; echo $c; // This is PHP course. $d = “Second sentence.” $e = $c.$d; //This is PHP course.Second sentence. echo $e; // This is PHP course.Second sentence. $f = $b.$e; //7This is PHP course.Second sentence.
  17. 17. • $a = 3, $b = 5 $a+$b, $a*$b • $c=“ccc”, $d=“ddd” $c.$d
  18. 18. • add.php add.php $_POST append •
  19. 19. c = ( a, b ); a: b: c:
  20. 20. • http://localhost/phpmyadmin/ • root ( ) • (o_id, amount, description, datetime) •
  21. 21. • SQL
  22. 22.
  23. 23. 結構化查詢語⾔(英語:Structured Query Language,縮寫:SQL) http://webdesign.kerthis.com/sql/
  24. 24. CRUD • (Create) • (Read) • (Update) • (Delete)
  25. 25. customers INSERT INTO `customers` (`C_Id`, `Name`, `City`) VALUES (3, ' ', ' '); INSERT INTO [ ] ( 1, 2, 3, ...) VALUES ( 1, 2, 3, ...)
  26. 26. customers SELECT `Name`, `Phone` FROM `customers` SELECT 1, 2,··· FROM ; SELECT * FROM ;
  27. 27. phpmyadmin SQL
  28. 28. PHP <?php $mysqli = new mysqli('localhost', 'root', '','0304'); if ($mysqli->connect_errno) { echo "Errno: " . $mysqli->connect_errno . "n"; echo "Error: " . $mysqli->connect_error . "n"; exit; } mysql_query("SET NAMES 'utf8'"); ?>
  29. 29. PHP SQL $sql = sprintf("INSERT INTO `tally_book`( `amount`, `description`) VALUES ('%s','%s')",$_POST['amount'], $_POST['description']); $result = $mysqli->query($sql); if($result){ echo " "; }else{ echo " "; }
  30. 30. • show.php • table
  31. 31. HTML
  32. 32. HTML
  33. 33. CSS 1 color:red; background-color:blue; font-size:large; font-size:30px;
  34. 34. CSS 2 <style> .aaa { color:#FF0000; } </style> <p class=“aaa"> Class </p>
  35. 35. CSS 3 <style> #footer { color:#FF00FF; } </style> <p id="footer"> ID </p>
  36. 36. index.html • 
 
 
 
 
 
 
 

  37. 37. index.html • 
 http://voky.com.ua/showcase/sky-forms/ examples/img/bg-cyan.jpg • img/bg-cyan.jpg
  38. 38. index.html
  39. 39. index.html <input class="sky_input" type="number" value="5566" name="amount"><br>
 
 <input class="sky_input" type="text" name=“description"><br>
 
 <input class="button" type="submit" value=" "> <div class="sky_form"> <form action="add.php" method="post"> <table> <tbody> <tr> <td class="fist_col"> </td> <td><input class="sky_input" type="number" value="5566" name="amount"></td> </tr> <tr> <td class="fist_col"> </td> <td><input class="sky_input" type="text" name="description"></td> </tr> <tr> <td class="fist_col"></td> <td><input class="button" type="submit" value=" "></td> </tr> </tbody> </table> </form> </div>
  40. 40. index.html(CSS) CSS
 
 https://gist.github.com/anonymous/5c65dce60bde84bfe508
  41. 41. http://codepen.io/tjoen/pen/LEpeq/
  42. 42. http://codepen.io/tjoen/pen/LEpeq/ CSS css/responstable.css
  43. 43. • <table> class=“responstable”
 
 
 
 
 
 
 
 show.php 
 https://gist.github.com/anonymous/3ed91df764e868f0ab7b

×