Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <pre>
- <?php
- $pixelsizes=Array("10","20","30","40");
- $colors=Array("#F00", "#0F0", "#00F", "#FF0");
- $types=Array("bold", "italic");
- if(isset($_POST['textbox'])){
- $textboxvalue=$_POST['textbox'];
- }else{
- $textboxvalue="Test";
- }
- echo "<form method='post' action='uppgift1a.php'>";
- // The code iterates over the array $pixelsizes and creates corresponding option tags
- echo "<select name='pixelsize'>";
- foreach($pixelsizes as $pixelsize){
- echo "<option>".$pixelsize;
- }
- echo "</select>";
- echo "<br>";
- echo "<form method='post' action='uppgift1a.php'>";
- echo "<select name='color'>";
- foreach($colors as $color){
- echo "<option>".$color;
- }
- echo "</select>";
- echo "<br>";
- echo "<form method='post' action='uppgift1a.php'>";
- echo "<select name='type'>";
- foreach($types as $type){
- echo "<option>".$type;
- }
- echo "</select>";
- echo "<br>";
- echo "<form action='uppgift1a.php' method='POST'>";
- echo "<input type='text' name='textbox' value=''>";
- echo "<input type='submit' value='OK' name='okbutton'>";
- echo "</form>";
- // This is where the new code goes!
- print_r($_POST);
- echo "<br><br>";
- if(isset($_POST['pixelsize'])){
- $pixelsize=$_POST['pixelsize'];
- }else{
- // $pixelsize="50";
- }
- if(isset($_POST['color'])){
- $color=$_POST['color'];
- }
- else{
- $color="#000";
- }
- if(isset($_POST['type'])){
- $type=$_POST['type'];
- }
- else{
- $type="normal";
- }
- echo "<div style='font-size:".$pixelsize."'px><div style='color:".$color."'><div style='font-weight:".$type."'><div style='font-style:".$type."'>$textboxvalue</div>";
- ?>
- </pre>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement