$ _POST Php çalışmıyor

0 Cevap

Ben burada yeni ve ben bir sorum var. Ben _POST ile onu anlamaya değil bir sorun var. Ben başlangıç ​​yazmadan önce saat arıyor! Bildiğim kadarıyla ben gördüğünüz gibi ben diğer benzer soru (form action ..., isim niteliği ..., vb) için yayınlanmıştır hatalar her yapmadım. , Sen ne yanlış yapıyorum bana anlatmak için aşağıdaki kodumu kontrol eder misiniz?

Ben windows 7 üzerinde xampp 1.7.3 kullanabilirsiniz.


<?php require("includes/header.php"); ?>
<?php require_once("includes/connection.php"); ?>
<?php require_once("includes/functions.php"); ?><head>
<script type="text/javascript">

function theChecker()
{
 if(document.getElementById('checker').checked){
     document.getElementById('submitter').disabled=false;
 }
 else{
     document.getElementById('submitter').disabled=true;
 }
}
</script>

</head>

<?php require("includes/body_no_menus.php"); ?>

<div align="center">
<form name="signup" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">

 <?php

 echo "<hr/>
<table width='600' border='0'>
  <tr>
    <td width='237'>Κωδικός οικοδομής</td>
    <td width='351'><input name='building_id' type='text' id='building_id' size='30' maxlength='40' />*</td>
  </tr>
  <tr>
    <td>Κωδικός διαμερίσματος</td>
    <td><input name='apartment_id' type='text' id='apartment_id' size='30' maxlength='40' />*</td>
  </tr>
  <tr>
   <td></td>
    <td height='31' colspan='2' ><label>
     <input name='send' type='submit' value='Αποστολή' />
    </label></td>
    </tr>

</table>
";
?>
</form>
</div>


<p>

<?php 

if(isset($_POST['send'])) {
 // Check input / Required fields
 $building_id = check_input($_POST['building_id'],"Εισάγετε τον κωδικό της οικοδομής!");
 $apartment_id = check_input($_POST['apartment_id'],"Εισάγετε όνομα χρήστη!");

 $query = "SELECT  idTENANT,FNAME,LNAME,BUILDING_ADMIN,PHONE FROM TENANT,APARTMENT, BUILDING
    WHERE  TENANT.APARTMENT_ID = APARTMENT.idAPARTMENT
    AND    APARTMENT.BUILDING_ID = BUILDING.idBUILDING
    AND  idAPARTMENT = '$apartment_id'
    AND  idBUILDING = '$building_id'";
 $result=mysql_query($query) or die ("Couldn't execute query.");
 $row = mysql_fetch_array( $result );  

 $id = $row['idTENANT'];
 $fname = $row['FNAME'];
 $lname = $row['LNAME'];
 $apartment = $row['APARTMENT_ID'];
 $phone = $row['PHONE'];
 if($row['BUILDING_ADMIN'] == 0)
  $admin = "ΟΧΙ";
 else
  $admin = "ΝΑΙ";
echo " <hr />
<table width='300' border='0'>
    <tr>     
     <td>Όνομα</td>           
  <td>$fname</td>   
 </tr>
    <tr>     
  <td>Επίθετο</td>          
  <td>$lname</td>   
 </tr>
    <tr>     
     <td>Όνομα χρήστη</td>        
     <td><input name='username' type='text' size='30' maxlength='20' />*</td>   
    </tr>
    <tr>     
  <td>Κωδικός χρήστη</td>      
  <td><input name='password' type='password' size='30' maxlength='20'/>*</td>   
 </tr>
    <tr>     
  <td>Επαλήθευση κωδικού</td>    
  <td><input name='verify_password' type='password' size='30' maxlength='40'/> *</td> 
 </tr>
    <tr>     
  <td>Διαχείριση οικοδομής</td>  
  <td>$admin</td>   
 </tr>
    <tr>     
  <td>Τηλέφωνο</td>            
  <td>$phone</td>   </tr>

    <tr>   
  <td></td>
  <td><input name='checkterms' type='checkbox' id='checker' onclick='theChecker()' value='Ναι'/>
    <label>Έχω διαβάσει και αποδέχομαι τους όρους χρήσης.</label> *</td>
   </tr>
   <tr>
    <td></td>
     <td><input type='submit' name='complete'  id='submitter' value='Ολοκλήρωση εγγραφής' disabled/></td>
  </tr>
</table>
";
}

if(isset($_POST['complete'])) {
 // Password match
 if ($password != $verify_password)
 {
   echo '<font color="red">Οι κωδικοί δεν ταιριάζουν</font>';
 }//if
 else 
 { 
  // Execute MySQL commands
  $query = "UPDATE TENANT SET USERNAME = '$un', PASSWD='$pw' WHERE idTENANT='$id'";
  $result=mysql_query($query) or die ("Couldn't execute query.");
  header("Location: main_login.php");
 }//else
}//if
?>

</p>
<?php require("includes/footer.php"); ?>

İlk _POST ((isset ($ _POST ['send'])) if ...) mükemmel çalışır. Ama (isset ($ _POST ['komple'])) {... hiçbir şey yaparsa. Ben bağlantı işe yaramazsa görmek için bazı verileri echo denedim, ama _POST ...

Lütfen bana yardım edin!!

Zaman ayırdığınız için teşekkürler!

0 Cevap