奇怪的错误。我已经测试过使用或者它没有用。
我有一个表单,我需要发送提交按钮的值,这里应该是{保存'$_POST['saveBtn']
我的表单声明如下:
<form id="clientFrm" action="index.php" class="form-horizontal form-label-left" method="post">
我试过这个:
<button id="saveBtn" name="saveBtn" type="submit" class="btn btn-success" value="save">save</button>
或
当我在Firefox(或IE或Edge)中执行var_dump时,我明白了:
array(16){
[[IDCompagnie“] =&gt; string(1)“1”
[“Nom”] =&gt; string(14)“Test”
[“Adresse”] =&gt; string(10)“test111111”
[“Ville”] =&gt; string(0)“”}
当我在Chrome中执行此操作时,一切正常!这里是Chrome中的var_dump:
array(17){[“IDCompagnie”] =&gt; string(1)“1”
[“Nom”] =&gt; string(14)“MI-Consultants”
[“Adresse”] =&gt; string(7)“test111”
[“Ville”] =&gt; string(0)“”
[“saveBtn”] =&gt; string(4)“save”}
我的表单中只有一个以'saveBtn'命名的元素......
你知道为什么它只适用于Chrome吗?
这是完整的代码:
<?php
$currentURL='index.php';
include 'header.php';
$db->connect();
//var_dump($_POST);
if( ISSET( $_POST['saveBtn'] ) && $_POST['saveBtn'] == 'save'){
unset($_POST['saveBtn']);
unset($_POST['telephone1']);
unset($_POST['telephone2']);
include 'misc/bd/saveCompagnie.php';
}
$cie = $db->getOne('compagnie');
if($cie){
foreach ($cie as $key => $value){
$$key = $value;
}
}
$db->where('IDCompagnie = 1');
$users = $db->get('user');
$db->__destruct();
?>
<!-- page content -->
<div class="right_col" role="main">
<div class="">
<div class="page-title">
<div class="title_left">
<h3>Modifier Informations Compagnie</h3>
<?php //var_dump($cie); ?>
</div>
</div>
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<div class="x_panel">
<div class="x_title">
<h2>Informations générales </h2>
<div class="clearfix"></div>
</div>
<div class="x_content">
<br />
<form id="clientFrm" action="index.php" data-parsley-validate class="form-horizontal form-label-left" method="post">
<input type="hidden" id="IDCompagnie" name="IDCompagnie" value="<?php echo ISSET($IDCompagnie) ? $IDCompagnie : '' ?>">
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="Nom">Nom <span class="required">*</span></label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input id="Nom" name="Nom" class="form-control col-md-7 col-xs-12" required="required" type="text" value="<?php echo ISSET($Nom) ? $Nom : '' ?>">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="Adresse">Adresse</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input id="Adresse" name="Adresse" class="form-control col-md-7 col-xs-12" type="text" value="<?php echo ISSET($Adresse) ? $Adresse : '' ?>">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="Ville">Ville</label>
<div class="col-md-6 col-sm-6 col-xs-12">
<input id="Ville" name="Ville" class="form-control col-md-7 col-xs-12" type="text" value="<?php echo ISSET($Ville) ? $Ville : '' ?>">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="Province">Province</label>
<div class="col-md-2 col-sm-2 col-xs-12">
<input id="Province" name="Province" class="form-control col-md-7 col-xs-12" type="text" value="<?php echo ISSET($Province) ? $Province : '' ?>">
</div>
<label class="control-label col-md-2 col-sm-2 col-xs-12" for="CodePostal">Code Postal</label>
<div class="col-md-2 col-sm-2 col-xs-12">
<input id="CodePostal" name="CodePostal" type="text" class="form-control" value="<?php echo ISSET($CodePostal) ? $CodePostal : '' ?>">
</div>
</div>
<div class="item form-group">
<label class="control-label col-md-3 col-sm-3 col-xs-12" for="telephone">Téléphone</label>
<div class="col-md-2 col-sm-2 col-xs-12">
<input id="telephone1" name="telephone1" type="text" class="form-control" data-inputmask="'mask' : '(999) 999-9999'" value="<?php echo ISSET($Telephone1) ? $Telephone1 : '' ?>">
<span class="fa fa-phone form-control-feedback right" aria-hidden="true"></span>
<input id="Telephone1" name="Telephone1" type="hidden" value="<?php echo ISSET($Telephone1) ? $Telephone1 : '' ?>">
</div>
<label class="control-label col-md-2 col-sm-2 col-xs-12" for="telephone">Téléphone</label>
<div class="col-md-2 col-sm-2 col-xs-12">
<input id="telephone2" name="telephone2" type="text" class="form-control" data-inputmask="'mask' : '(999) 999-9999'" value="<?php echo ISSET($Telephone2) ? $Telephone2 : '' ?>">
<span class="fa fa-phone form-control-feedback right" aria-hidden="true"></span>
<input id="Telephone2" name="Telephone2" type="hidden" value="<?php echo ISSET($Telephone2) ? $Telephone2 : '' ?>">
</div>
</div>
<div class="clear-margin"></div>
<div class="x_title">
<h2>Autres Informations </h2>
<div class="clearfix"></div>
</div>
<div class="item form-group">
<label class="control-label col-md-2 col-sm-2 col-xs-12" for="TauxHoraire">Taux Horaire</label>
<div class="col-md-2 col-sm-2 col-xs-12">
<input type="text" id="TauxHoraire" name="TauxHoraire" min="0" class="form-control col-md-7 col-xs-12" value="<?php echo ISSET($TauxHoraire) ? $TauxHoraire : '' ?>">
<span class="fa fa-usd form-control-feedback right" aria-hidden="true"></span>
</div>
<label class="control-label col-md-2 col-sm-2 col-xs-12" for="Financement">Financement</label>
<div class="col-md-2 col-sm-2 col-xs-12">
<input type="text" id="Financement" name="Financement" class="form-control col-md-7 col-xs-12" value="<?php echo ISSET($Financement) ? $Financement : '' ?>">
<span class="fa fa-percent form-control-feedback right" aria-hidden="true"></span>
</div>
<label class="control-label col-md-2 col-sm-2 col-xs-12" for="EntenteSignature">Entente Signature</label>
<div class="col-md-2 col-sm-2 col-xs-12">
<input type="number" id="EntenteSignature" name="EntenteSignature" min="0" max="100" class="form-control col-md-7 col-xs-12" value="<?php echo ISSET($EntenteSignature) ? $EntenteSignature : 50 ?>">
<span class="fa fa-percent form-control-feedback right" aria-hidden="true"></span>
</div>
</div>
<div class="clear-margin"></div>
<div class="x_title">
<h2>Valeurs constantes </h2>
<div class="clearfix"></div>
</div>
<div class="item form-group">
<label class="control-label col-md-2 col-sm-2 col-xs-12" for="CoutEnvoiPoste">Coût Envois Postaux (unitaire)</label>
<div class="col-md-2 col-sm-2 col-xs-12">
<input type="text" id="CoutEnvoiPoste" name="CoutEnvoiPoste" maxlength="5" class="form-control col-md-7 col-xs-12" value="<?php echo ISSET($CoutEnvoiPoste) ? $CoutEnvoiPoste : 0.00 ?>">
<span class="fa fa-usd form-control-feedback right" aria-hidden="true"></span>
</div>
<label class="control-label col-md-2 col-sm-2 col-xs-12" for="CoutMachineTimbre">Coût Machine à Timbre (mensuel)</label>
<div class="col-md-2 col-sm-2 col-xs-12">
<input type="text" id="CoutMachineTimbre" name="CoutMachineTimbre" maxlength="5" class="form-control col-md-7 col-xs-12" value="<?php echo ISSET($CoutMachineTimbre) ? $CoutMachineTimbre : 0.00 ?>">
<span class="fa fa-usd form-control-feedback right" aria-hidden="true"></span>
</div>
<label class="control-label col-md-2 col-sm-2 col-xs-12" for="PctImpressionPapeterie">% d'impression et papeterie</label>
<div class="col-md-2 col-sm-2 col-xs-12">
<input type="number" id="PctImpressionPapeterie" name="PctImpressionPapeterie" min="0" class="form-control col-md-7 col-xs-12" value="<?php echo ISSET($PctImpressionPapeterie) ? $PctImpressionPapeterie : 0 ?>">
<span class="fa fa-percent form-control-feedback right" aria-hidden="true"></span>
</div>
</div>
<div class="larger clear-margin"></div>
<div class="x_title">
<h2>Listes des Utilisateurs </h2>
<div class="clearfix"></div>
</div>
<div class="item form-group">
<table id="datatable-buttons" class="table table-striped table-bordered dt-responsive nowrap" cellspacing="0" width="100%">
<thead>
<tr>
<th>Nom</th>
<th>Prénom</th>
<th>Username</th>
<!-- th>Rôle</th-->
</tr>
</thead>
<tbody>
<?php
foreach( $users as $row ) {
?>
<tr>
<td><?php echo setEncodage($row['Nom'])?></a></td>
<td><?php echo setEncodage($row['Prenom'])?></td>
<td><?php echo setEncodage($row['Username'])?></td>
<!-- td><?php //echo $row['Role']?></td-->
</tr>
<?php
}
?>
</tbody>
</table>
</div>
<div class="ln_solid"></div>
<div class="form-group">
<div class="col-md-12 col-md-offset-5">
<input id="cancelBtn" name="cancelBtn" type="button" class="btn btn-primary" value="Cancel">
<button id="saveBtn" name="saveBtn" type="submit" class="btn btn-success" value="save">Enregistrer</button>
</div>
</div>
<div class="ln_solid"></div>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- /page content -->
<?php
include 'footer.php';
include 'js/pageJS/indexJS.php'
?>
</body>
</html>