Advertisement
Guest User

Untitled

a guest
May 27th, 2015
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1.  
  2. <html>
  3. <body>
  4. <pre>
  5. <?php
  6.  
  7.  
  8.  
  9.  
  10. $pixelsizes=Array("10","20","30","40");
  11. $colors=Array("#F00", "#0F0", "#00F", "#FF0");
  12. $types=Array("bold", "italic");
  13.  
  14. if(isset($_POST['textbox'])){
  15. $textboxvalue=$_POST['textbox'];
  16. }else{
  17. $textboxvalue="Test";
  18. }
  19. echo "<form method='post' action='uppgift1a.php'>";
  20.  
  21. // The code iterates over the array $pixelsizes and creates corresponding option tags
  22. echo "<select name='pixelsize'>";
  23. foreach($pixelsizes as $pixelsize){
  24. echo "<option>".$pixelsize;
  25. }
  26. echo "</select>";
  27. echo "<br>";
  28. echo "<form method='post' action='uppgift1a.php'>";
  29. echo "<select name='color'>";
  30. foreach($colors as $color){
  31. echo "<option>".$color;
  32. }
  33. echo "</select>";
  34. echo "<br>";
  35.  
  36. echo "<form method='post' action='uppgift1a.php'>";
  37.  
  38. echo "<select name='type'>";
  39. foreach($types as $type){
  40. echo "<option>".$type;
  41. }
  42. echo "</select>";
  43.  
  44.  
  45. echo "<br>";
  46.  
  47.  
  48. echo "<form action='uppgift1a.php' method='POST'>";
  49. echo "<input type='text' name='textbox' value=''>";
  50. echo "<input type='submit' value='OK' name='okbutton'>";
  51. echo "</form>";
  52.  
  53. // This is where the new code goes!
  54. print_r($_POST);
  55. echo "<br><br>";
  56.  
  57. if(isset($_POST['pixelsize'])){
  58. $pixelsize=$_POST['pixelsize'];
  59. }else{
  60. // $pixelsize="50";
  61. }
  62.  
  63. if(isset($_POST['color'])){
  64. $color=$_POST['color'];
  65. }
  66. else{
  67. $color="#000";
  68.  
  69. }
  70.  
  71. if(isset($_POST['type'])){
  72. $type=$_POST['type'];
  73. }
  74. else{
  75. $type="normal";
  76.  
  77. }
  78.  
  79. echo "<div style='font-size:".$pixelsize."'px><div style='color:".$color."'><div style='font-weight:".$type."'><div style='font-style:".$type."'>$textboxvalue</div>";
  80.  
  81.  
  82.  
  83. ?>
  84. </pre>
  85. </body>
  86. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement