php - Store values between multiple post back from user -
the idea of code make user choose flight decrease(-1) flight seats of flight chooses.
when user change flight decrease new flight(-1) seats , increase previous flight seats since user changed flight.
but don't know how hold previous flight id, actually tried failed,anyway..
how store previous flight id?
because variable gets reset every time page gets reloaded clicking submit button (this happened, because have initiate flight id holder variable every time open page).
is holding possible?...
here did try , use sessions:
$flight_id = '';//empty $_session['prev_flight_id'] = $flight_id; // initiate session echo $_session['prev_flight_id']; // make sure there's here // result nothing(empty) important note: set value of $flight_id // later in script
i tried :
session_start(); // bunch of code (i didn't create $flight_id yet) : // submiting old flight id in session (i error here) $_session['prev_flight_id'] = $flight_id; echo $_session['prev_flight_id']; // flight_id text area $flight_id = $_post['flight_id_res']; // result : undefined variable: flight_id...
php
make use of sessions.
mysql
or use mysql set @@global.your_var
globally store , select
retrieve flight id.
Comments
Post a Comment