Welcome to WebmasterWorld Guest from 54.162.213.67

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP Sessions with select tag

     
8:38 am on Jun 30, 2012 (gmt 0)

New User

joined:June 30, 2012
posts: 1
votes: 0


i'm working on a site where there is select tag

<form name="frmSel" method="POST">
<label><strong style="color:#0084D0;font-size:15px;font- weight:bold;">Centers : </strong> </label>
<select name="centers">
<option value="">Select</option>
<option value="index-page-1">index page1</option>
<option value="index-page-2">index page2</option>
</select>
</form>

what i want is after selecting any option it should go on respective page through php sessions and respective value should be stored in that session.
there are inner pages which are same for both index pages.
but there is some data which should change after selecting any option on main index page.
i was trying to use if condition in session but it doesn't worked.

<?php
session_start();
$center=$_POST['centers'];
$flag=0;
if(session_name($center)== "index-page-1")
{
session_register('index-page-1');
}
else
{
$flag=1;
}
?>

and then in inner page(its sample)
<?
if($flag==0)
{?>
<p> some text1 </p>
<?
}
else
{?>
<p> some text2 </p>
<?}?>

plz help me!
8:54 pm on Jan 20, 2013 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12541
votes: 1


A belated welcome to WebmasterWorld, trumanya.

Did you ever get this resolved? It's not quite clear to me what you are attempting to accomplish.