2016-03-29 15 views
-2

görünecektir. Formuma nasıl bir düğme ekleyeceğimi bilmiyorum, böylece kullanıcı gönder düğmesini eklediğinde ve bastığında, veri bir sunucu tarafından geri gönderilir komut dosyası ve kullanıcıya geri kullanıcı ve bilgiyi onaylamak için bir evet veya hayır düğmesine tıklar. sadece bir evet ya da hayır düğmeye istiyorsanız evet programı sayesindeFormumda evet ve hayır düğmesine ihtiyacım var. Bilgi doğruysa ve evet tıklanırsa teşekkürler

<html> 
     <head> 
      <title>Test1-1</title> 
     </head> 
     <body> 
    <?php 

    if (filter_has_var(INPUT_POST, "name")){ 

    $name = filter_input(INPUT_POST, "name"); 
    print "<p>Hi $name, </p>"; 
    } 

    if (filter_has_var(INPUT_POST, "id")){ 

    $id = filter_input(INPUT_POST, "id"); 
    print "<span>Your Employee ID is $id</span>"; 
    } 

    if (filter_has_var(INPUT_POST, "office")){ 

    $office = filter_input(INPUT_POST, "office"); 
    print "<span>, your office is room $office</span>"; 
    } 

    if (filter_has_var(INPUT_POST, "os")){ 

    $os = filter_input(INPUT_POST, "os"); 
    print "<span>, and your OS is $os</span>"; 
    } 

    else { 


    //there's no input. Create the form 
    print <<< HERE 

    <form action ="" method = "post"> 
    <fieldset> 
    <label>Enter your name</label> 
    <input type = "text" 
      name = "name"/><br> 
    <label>Employee ID</label> 
    <input type = "text" 
      name = "id"/><br> 
    <label>Office Room Number</label> 
    <input type = "text" 
      name = "office"/><br> 
    <label>Oberating System on the Office Computer</label> 
    <input type = "text" 
      name = "os"/><br> 
    <button type = "submit"> 
    submit 
    </button> 
    </fieldset> 
    </form> 
    HERE; 
    }// end 'value exists' if 
    ?> 
     </body> 
    </html> 
+0

basit html ihtiyaç form verisi sunucu tarafı koduna, daha sonra geri döndüğünde html güncellemek böylece kullanıcı daha sonra evet/hayır düğmesini görür. Buradan, evet/hayır'ı tıkladıklarında ne olacağını işlemek için daha fazla ajax koduna ihtiyacınız olacak. –

cevap

0

itiraz olursa o zaman sadece muhtemelen gönderebilmesi için ajax kullanmak istediğiniz olacak <input type="button" value="YES"> <input type="button" value="NO">

İlgili konular