Jump to content

[SOLVED] WHY does this not work? Text box values and SESSION


NoPHPPhD

Recommended Posts

Very very basic. Trying to get this to where I can enter amounts in text boxes, click Enter, and the amounts are still there. Want to do totals and checking if numeric later, but cant get basic stuff to work.

<?php
session_start();
?>

<form method="post" action="<?php echo $PHP_SELF; ?>">

<?php
if (isset($_POST['submit'])) {

  $_SESSION['3_c1_bx1'] = $_POST['3_c1_bx1'];
  $_SESSION['3_c1_bx2'] = $_POST['3_c1_bx2'];
  $_SESSION['4_c1_bx1'] = $_POST['4_c1_bx1'];
  $_SESSION['4_c1_bx2'] = $_POST['4_c1_bx2'];
  $_SESSION['5_c1_bx1'] = $_POST['5_c1_bx1'];
  $_SESSION['5_c1_bx2'] = $_POST['5_c1_bx2'];
  $_SESSION['total_bx1'] = $_POST['total_bx1'];
  $_SESSION['total_bx2'] = $_POST['total_bx2'];
}
?>

<input type="submit" name = "submit" value="Enter" />

<table class="means" cellpadding="1">

<tr>
<td>Gross wages:</td>
<td><input type="text" size="5" maxlength="9" name="3_c1_bx1" value="<?php $_SESSION['3_c1_bx1']; ?>"/></td>
<td><input type="text" size="5" maxlength="9" name="3_c1_bx2"/></td>
</tr>
<tr>
<td>Gross salary:</td>
<td><input type="text" size="5" maxlength="9" name="4_c1_bx1"/></td>
<td><input type="text" size="5" maxlength="9" name="4_c1_bx2"/></td>
</tr>
<tr>
<td>Gross tips:</td>
<td><input type="text" size="5" maxlength="9" name="5_c1_bx1"/></td>
<td><input type="text" size="5" maxlength="9" name="5_c1_bx2"/></td>
</tr>
<tr>
<td>Total:</td>
<td><input type="text" size="5" maxlength="9" name="total_bx1"/></td>
<td><input type="text" size="5" maxlength="9" name="total_bx2"/></td>
</tr>
</table>
</form>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.