lundi 30 mars 2015

HTML Form Using Values In Multiple Places

I have 3 files.


1st one :



<html>
<form action="employeeDel.php" method ="post">
Enter Ssn To Delete Employee:<br>
<input type="number" name="ssnDel">
<br>
<br>
<input type="submit" value="Submit">
</form>
</html>


This form sends data to employeeDel.php.


employeeDel.php :



<html>
<form action ="employeeDelFinal.php" method="post">
<input type="hidden" name="ssn" value="ssnDel">

<?php
$ssnDel = $_POST ["ssnDel"];

$sql = "SELECT * from employee WHERE ssn=".$ssnDel;

<input type="submit" name="Delete?">
</form>
</html>


From here, when user clicks on submit button, I want html form to send ssnDel value to employeeDelFinal.php file.


employeeDelFinal.php :



<?php
$ssnDel = $_POST ["ssn"];
echo ssnDel;
?>


That value never reaches here. I got an error on employeeDel.php file, it says value of ssnDel is null. I guess in the beginning of form in employeeDel file, I create ssnDel again, so it becomes null. Is there a way to send a data from html form to employeeDel.php, from employeeDel.php to employeeDelFinal.php by using form? I tried hidden text but it didn't solve my problem as seen.


Aucun commentaire:

Enregistrer un commentaire