Passing PHP Session Value -


i'm attempting pass value 1 wordpress page through php session. have dropdown list on both pages, identical except option values. selected option on 2nd page @ page load reflect chosen value submitted on first page.

i've looked lot of questions haven't been able find need. appreciated!

page 1:

<?php     if(!isset($_session)) {          session_start();          echo $_session['state'];         $var_value = $_session['state'];     }  ?>  <form>     <input type=hidden name="returl" value="page2.php">     <select id="state" name="state">         <option>state 1</option>         <option>state 2</option>         <option>state 3</option>     </select>     <input type="submit" name="submit" value="submit"> </form> 

page 2:

<?php     session_start();     if(isset($_post['state'])){         $_session['state'] = $_post['state'];     } ?>  <select>     <option <?php if($var_value == 'state 1') echo 'selected'; ?> value="http://customizedlink">state 1</option>     <option <?php if($var_value == 'state 2') echo 'selected'; ?> value="http://customizedlink">state 2</option>     <option <?php if($var_value == 'state 3') echo 'selected'; ?> value="http://customizedlink">state 3</option> </select> 

wordpress core not use php sessions. wordpress platform totally stateless , provides no support use of sessions outside of cookie keeps user logged in.

wordpress core not use php sessions, required use-case, plugin or theme.

you can use wordpress native php sessions plugin implements php’s native session handlers, backed wordpress database.

see using php session in wordpress


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -