Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
dvprog15 [2020-05-18 20:25]
Daniel Viström
dvprog15 [2022-07-18 13:20] (current)
Line 85: Line 85:
    
 include 'foot.php'; include 'foot.php';
 +</code>
 +
 +Alternativt kan man hantera formuläret så här där php startas och stängs mitt i HTML-koden:
 +<code php>
 +<?php
 +
 +// Alla kontroller här som ovan.
 +
 +include('head.php');
 +
 +// Alla utskrifter här som ovan.
 +
 +?>
 +
 +<form method="post">
 +   <input type="text" placeholder="Namn" name="namn"><br>
 +   <input type="text" placeholder="Ålder" name="alder"><br>
 +   <input type="hidden" name="namn2" value="<?php echo $_POST['namn'] ?>">
 +   <input type="submit" name="submit" value="Skicka">
 +</form>
 +
 +<?php
 +include('foot.php');
 </code> </code>
  
 Kolla upp [[http://www.php.net/manual/en/ref.strings.php|strängfunktionerna]] för att hantera html-taggar i saker som matas in i formulär. Kolla upp [[http://www.php.net/manual/en/ref.strings.php|strängfunktionerna]] för att hantera html-taggar i saker som matas in i formulär.