Welcome Guest, Not a member yet? Register   Sign In
how to modify a text field on a form

(This post was last modified: 01-20-2021, 06:05 AM by richb201.)

I have a text field on a form:
echo "<br><br><br><br><br><br><h3>Report for:  ".$_SESSION['campaign']." for tax year ended ".$_SESSION['last_TY'];

Then I have the rest of the page:
<form method="post">
    "data"=>$_SESSION['TY'],  //this is a list of years in an array
    <button type="submit">Submit</button>

here is where I am trying to get the user's input:
if (isset($_POST['taxyear']))

Plus a whole report. 

After a user presses the submit button, I'd like to update the for tax year ended ".$_SESSION['last_TY'] in the text field. 

But I am finding that the $_SESSION['taxyear'] is not getting updated as I thought it would. It seems to be delayed until I press submit a 2nd time. Each time they hit submit, the entire page is run (which is good) but I need to set the $taxyear before running it. I have set up a default taxyear in $_SESSION['tax_year'] in my controller that gets used the first time they display the form. 

How do I get the submit button to control this thing (except the first time, when it should use the default I have set)? What I would like is for a user to pick a tax year from $_SESSION['TY'] list, update [font=Tahoma, Verdana, Arial, sans-serif]Report for:  ".$_SESSION['campaign']." for tax year ended ".$_SESSION['last_TY'];, and then rerun the page with the new $taxyear, [/font]
proof that an old dog can learn new tricks

Messages In This Thread
how to modify a text field on a form - by richb201 - 01-20-2021, 04:38 AM

Theme © iAndrew 2016 - Forum software by © MyBB