javascript - Changing PHP Session variables on click event -


please me on problem. small causing me lot of trouble.i have set session variable in index.php , when clicked on anchor tag , not changing session variable. relevant php part:

session_start(); $_session["amount"] = "99"; 

now html part (in same php file).

<a onclick="change('<?php echo $_session['amount']='399'; ?>')" href="#"><h4>order 399</h4></a>  <a onclick="change('<?php echo $_session['amount']='200'; ?>')" href="#"><h4>order 200</h4></a> 

i checking value of session variable in div in same file.

<td>amount: <?php echo $_session["amount"] ?> </td> 

the value shown 200 though clicked on "order 399".

how change session variable?am mixing client side , server side? please me , suggest shortest possible way it.

actually mixing up!

it done this:

you need js-function, calls php-file, change value of session variable. , don't forget: locate values on loaded page via js, because won't change instantly. sure change on page-reload, if want avoid page reload, change values, on page.

jquery ajax , append huge here.

if have tried , have still problems, ask again, please try first yourself!


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -