Jump to content

lilNuki

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

lilNuki's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. This one what i have made. nothing more <?php $tiitel = "Teine tund"; $aeg = date("H:i:s"); $leht = $_GET["leht"]; if($leht == "teine") { $pealkiri = "Ülesanne 2"; $sisu = "Muutuja väärtus on: "; $sisu .= $_GET["muutuja"]. "<br>ja selle pikkus on: ". strlen($_GET["muutuja"]); } elseif($leht == "kolmas") { $pealkiri ="Ülesanne 3"; $sisu =" <b>Vormid</b><br>" ; $sisu .= <<<EOF <form method="post" action="?leht=kolmas"> Nimi: <input type="text" name="nimi"><br> E-post: <input type="text" name="epost"><br> <input type="submit" value="SAADA" name="saada"> </form> EOF; if(isset($_POST["saada"])){ //if $_POST["saada"] !="" $sisu.="<br><br>". "Vormilt saadi järgmised andmed:<br>". "Nimi on ". $_POST["nimi"]." ja e-post on ". $_POST["epost"]."<br>"; } } elseif($leht == "KALK"){ $pealkiri = "KALK"; $sisu = 'Kalkulaator'; $sisu .= <<<EOF <form method="POST" action="?leht=KALK"> <label>Arv 1: </label><input type="text" name="arv1" /> <select> <option value="add" name="sum">liida</option> <option value="sub" name="sum">lahuta</option> <option value="mul" name="sum">korruta</option> <option value="div" name="sum">jaga</option> </select> <label>Arv 2: </label><input type="text" name="arv2" /> <br /> <input type="submit" value="Sisesta" /> </form> EOF; if ($_POST['arv1']){ $arv1 = $_POST['arv1']; $arv2 = $_POST['arv2']; $arv3 = $arv1+$arv2; $arv4 = $arv1-$arv2; $arv5 = $arv1*$arv2; $arv6 = $arv1/$arv2; } echo "Nende summa on:"; echo $arv3; echo "<br>Nende vahe on:"; echo $arv4; echo "<br>Nende korrutis on:"; echo $arv5; echo "<br>Nende jagatis on:"; echo $arv6; } elseif($leht == "Galerii") { $pealkiri = "Pildigalerii"; $pilt = $_GET["pilt"]; if($pilt){ $kuva = '<img src="'.$pilt.'.png" alt=pilt"'.$pilt.'">'; } else $kuva = "Vali menüüst pilt."; $sisu = <<<EOF <table border="1"> <tr><td width="150px"><ul> <li><a href="?leht=Galerii&pilt=pilt1">Pilt 1</a></li> <li><a href="?leht=Galerii&pilt=pilt2">Pilt 2</a></li> <li><a href="?leht=Galerii&pilt=pilt3">Pilt 3</a></li> <li><a href="?leht=Galerii&pilt=pilt4">Pilt 4</a></li> <li><a href="?leht=Galerii&pilt=pilt5">Pilt 5</a></li> </ul></td><td> $kuva </td></tr></table> EOF; } else{ $pealkiri = " Tere tulemast !"; $sisu = "Hetkene kell $aeg"; } function leht2() { $s = ""; for( $i=1; $i<=10; $i++) { $s .= $i . "->"; } $s .= "...<br>"; return $s; } ?> <html> <head> <title><?=$tiitel;?></title> </head> <body> <h1><?=$pealkiri;?></h1> <br> <a href="?leht=">Esimene leht</a> | <a href="?leht=teine&muutuja=Tere Marco">Teine leht</a> | <a href="?leht=kolmas">Kolmas leht</a> | <a href="?leht=KALK">Kalkulaator</a> | <a href="?leht=Galerii">Galerii</a> <br> <?=$sisu;?> </body> </html>
  2. I need to to 3 php code exercises at school but i dont know have to us this commands. actually i dont have php coding skills. 1. If u open page then showing time and if time is 12 o'clock then there appears text "afternoon" if time is 18 then text "good night" and if time is 06:00 then good morning. I dont have any clue how do do it. 2. Second one ise calc i have googled them but they all are so diificult to under stand. i have made only form but dont know how do make php code for this. <form method="POST" action="?page=calc"> <label>Number 1: </label><input type="text" name="num1" /> <select> <option value="add" name="sum">Add</option> <option value="sub" name="sum">Subtract</option> <option value="mul" name="sum">Multiply </option> <option value="div" name="sum">Divide</option> </select> <label>Number 2: </label><input type="text" name="num2" /> <br /> <input type="submit" value="CALC" /> and after i calc then there should be option box to remember first number to continue calculating if need. 3. and third exercise is if i put roman numberto box then it should be coding this number to arabic number like "L=50" and backwards too "50=L". I hope that I didnt make trouble for asking this. I really need help for this =)
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.