I am attempting to write a script that when a user selects a radio button it will redirect to the approriate script. but it keeps going to only one page and theat is my p5modify ....what am I doing wrong

<?php
session_start();
if (session_id() != $_SESSION["userid"]) {
$_SESSION['unerror'] = "<font color='red'>You Must Be Logged In.</font>";
header("Location: welcomeinput.php");} 
?>


<?php
echo "<h1>Welcome Member</h1>";

if(isset($_POST['login'])) 
{
$server = 'localhost';
$user = 'root';
$datapassword = '';
$database = 'km';
$table_name = 'subscribers';

$action = $_POST['action'];
$status = "modify";
$statusb = "unsubscribe";
$statusc = "logoff";

$connect = mysql_connect($server, $user, $datapassword) or die ("Could Not Connect!");
mysql_select_db($database, $connect) or die ("Could Not Connect!");
}
//if(session_id()==$_SESSION["userid"]){
   if (isset($_POST['modify']))  {
    header("location: p5modify.php");
   } 
   else if (isset($_POST['unsubscribe']))  {
    header("location: p5unsuscribe.php");
   }
   else if (isset($_POST['logoff']))  {
   header("location: p5logout.php");
   }
   


?>
<form action='p5member.php' method='POST'>
<input type="radio" name="action" value="modify"> Modify<br>
<input type="radio" name="action" value="unsubscribe"> Unsubcribe<br>
<input type="radio" name="action" value="logoff"> logoff<br>
<input type="submit" value="submit">

u r doing a big blunder error...
u r using form and in that action is set "p5member.php" so it will redirect to that page only...

I made the changes and now it is going to s blank screen instead of going to the redirected pages here is my input code

<?php

echo "<h1>Welcome Member</h1>";
session_start();
if (session_id() != $_SESSION["userid"]) {
$_SESSION['unerror'] = "<font color='red'>You Must Be Logged In.</font>";
header("Location: welcomeinput.php");} 
?>

<form action='p5memberoutput.php' method='POST'>
<input type="radio" name="action" value="modify"> Modify<br>
<input type="radio" name="action" value="unsubscribe"> Unsubcribe<br>
<input type="radio" name="action" value="logoff"> logoff<br>
<input type="submit" value="submit">

and this is my output page

<?php
session_start();
if (session_id() != $_SESSION["userid"]) {
$_SESSION['unerror'] = "<font color='red'>You Must Be Logged In.</font>";
header("Location: welcomeinput.php");} 
?>


<?php

if(isset($_POST['login'])) 
{
$server = 'localhost';
$user = 'root';
$datapassword = '';
$database = 'km';
$table_name = 'subscribers';

$action = $_POST['action'];
$status = "modify";
$statusb = "unsubscribe";
$statusc = "logoff";

$connect = mysql_connect($server, $user, $datapassword) or die ("Could Not Connect!");
mysql_select_db($database, $connect) or die ("Could Not Connect!");
}
//if(session_id()==$_SESSION["userid"]){
   if (isset($_POST['modify']))  {
    header("location: p5modify.php");
   } 
   else if (isset($_POST['unsubscribe']))  {
    header("location: p5unsuscribe.php");
   }
   else if (isset($_POST['logoff']))  {
   header("location: p5logout.php");
   }
   


?>

again u did a mistake....it should not be $_POST,$_POST,$_POST....
these are values send to the radio button...
it shoud be like this .....

if ($_POST['action]=="modify")  {
    header("location: p5modify.php");
   } 
   else if ($_POST['action']=="unsubscribe")  {
    header("location: p5unsuscribe.php");
   }
   else if ($_POST['action']=="logoff")  {
   header("location: p5logout.php");
   }

for more precise solution plz tell me what do u want to do......actually.....

i am trying to have a script for a user to click on midify if they want to change their password and account info and click on unsuscribe if they want to unsubscribe from the newsletter and log out if they want to log out I couldnt figure out how to do it all on one page so I was redirecting them to a page for each selection...I think I may be confusing myself even more because I am so new to this...lol

Member Avatar for diafol

This can easily be done on one page - like a profile page. [pw | new pw | confirm pw | subscription]

The logout should be a link rather than a form field or button - keep this separate.

for that u didn't require a check box...
just use a link..it will be easily done.....If still prblm persistes....i will do it for u.....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.