html - Using PHP Sessions to update content on another page -
just learnt php sessions need learn how use them properly. can declare variables on seperate php document , call them other pages? if can show me simple example.
also note snippet below in html
<select id="baby_status"> <option value="playing">playing</option> <option value="awake">awake</option> <option value="sleeping">sleeping</option> </select>
how use php example: if baby status = "awake"
when click submit display picture of baby being awake on page 2?
an explanation great if can show me code use great still learning.
thanks in advance
you can using $_post
your html code this.
<form method="post" action="page2.php"> <select name="baby_status"> <option value="playing">playing</option> <option value="awake">awake</option> <option value="sleeping">sleeping</option> </select> <input type="submit" value="submit"/> </form>
and page2.php
this.
<?php if (isset($_post['baby_status'])) { $baby = $_post['baby_status']; if ($baby == "awake") { echo '<img src="awaking_baby.png"/>'; } } ?>
if answer worked don't forget mark correct. because other solve there problem. thank you.
Comments
Post a Comment