relocation

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
zuzupus
Forum Commoner
Posts: 70
Joined: Thu Jul 17, 2003 4:54 am

relocation

Post by zuzupus »

hi,

i created one radio button and one user select so that when user selects radio whose values coming from database after that if he submit the page withoust selecting user it will locate to diff. page, but i dont no its not working in my case

Code: Select all

<form action="diradmin.php" method="post">   
<? foreach($tree as $r) { ?>
<input type="radio" name="ddir" value="<?=$r->sys_pk ?>" id="<?="dir{$r->sys_pk}" ?>" />
<? } ?>
user
<select name="user">
<option selected="selected">** Please select**</option>
                     <? foreach($users as $r) { ?>
 <option value="<?=$r->sys_pk ?>"><?=htmlentities($r->name) ?></option>
                                                             <? } ?>
 </select>
<input type="submit" name="modify" value="Modify" />

there  is one lib php file in which all functions r defined

diradmin.php
<? $dir = './'; require($dir.'lib.php'); get_session(); ?>
if ($modify && $ddir) 
{
	if (!$user) {
                 	send_location_die('dirmodify.php?id='.$ddir);
                    } 
}

in lib.php
function send_location_die($location) 
{
	send_location($location);
	die();
}
function send_location($location) 
{
		expire_header();
		header("Location: ".$location);
		flush();
}
but when user selects radio and not selecting any user after that form submission its not locationg to dirmodify.php,i will go amd its so easy i dont no why its not submitting to this page

thanks in advance
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Code: Select all

function send_location($location)
{
      expire_header(); // unless you've programmed and included a function like this, it doesn't exist. Just delete this line.
      header("Location: ".$location);
      flush();
}
zuzupus
Forum Commoner
Posts: 70
Joined: Thu Jul 17, 2003 4:54 am

Post by zuzupus »

[thanks alot
Post Reply