Webbserverprogrammering 1

Show sourcecode

The following files exists in this folder. Click to view.

webbserverprogrammering/exercises/textsträngar/

textsträng1.php
textsträng2.php
textsträng3.php
textsträng4.php
textsträng5.php
textsträng6.php

textsträng1.php

51 lines UTF-8 Windows (CRLF)
<?php
error_reporting
(-1);
ini_set('display_errors'1);
ini_set('output_buffering'0); 
?>
<!DOCTYPE html>
<html lang="sv">
<head>
 <meta charset="utf-8" />
 <title>Textsträng 1</title>
</head>
<body>
 <?php
 
if (!isset($_POST["Förnamn"]) && !isset($_POST["Efternamn"]) && !isset($_POST["Epost"])) {
  
?>
  <h1>Textsträng 1</h1>
  <form method="post" action="">
   <table>
    <tr>
     <td>Förnamn</td>
     <td><input type="text" name="Förnamn"></td>
    </tr>
    <tr>
     <td>Efternamn</td>
     <td><input type="text" name="Efternamn"></td>
    </tr>
    <tr>
     <td>Epost</td>
     <td><input type="text" name="Epost"></td>
    </tr>
    <tr>
     <td></td>
     <td><input type="submit" value="Skicka"></td>
    </tr>
   </table>
  </form>
  <?php
 
}
 if (isset(
$_POST["Förnamn"]) && isset($_POST["Efternamn"]) && isset($_POST["Epost"])) {
  
$förnamn mb_strtoupper(substr($_POST["Förnamn"], 01)) . mb_strtolower(substr($_POST["Förnamn"], 1));
  
$efternamn mb_strtoupper(substr($_POST["Efternamn"], 01)) . mb_strtolower(substr($_POST["Efternamn"], 1));
  if (!
mb_strpos($_POST["Epost"], "@")) {
   echo 
"Ange en giltig Epost";
   exit();
  }
  echo 
$förnamn."<br>".$efternamn."<br>".$_POST["Epost"] ;
 }
 
?>

</body>
</html>