php - set session variable or local storage in javascript -
i have many php pages have different forms. want submit forms page called insertproc.php in call stored procedures insert data. submitting form data using jquery.should set session variables in jquery script after every form submission ? or can acheive other functionality. example: if have 3 pages page1.php, page2.php, page3.php has 1 form each form1.php, form2.php, form3.php. have submit 3 forms insertproc.php. in insertproc.php have check form have submitted. accordingly have run respective stored procedure. should set session variable in jquery after submit form
$session['proc_name'] = 'insert_user';
and check in insertproc.php value of session variable call respective stored procedure. please guide me how can achieve functionality.
if submit form jquery can add input field <form>
element says form it, example, form1.php
:
<form ...> ... <input type="hidden" name="source" value="form1"/> </form>
form2.php
:
<form ...> ... <input type="hidden" name="source" value="form2"/> </form>
etc.
then can check in php code did submitted values come checking $_post['source']
. no need sessions. sessions source of errors here - if open form1
, not submit, open form2
in tab, come form1
, submit form1
? guess session variable contain value form2
instead of form1
.
Comments
Post a Comment