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-01-09 13:38]
Daniel Viström
dvprog15 [2020-12-18 10:27]
Daniel Viström
Line 85: Line 85:
    
 include 'foot.php'; include 'foot.php';
-?></code>+</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>
  
 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.