~n[EO]n~ Posted October 4, 2007 Share Posted October 4, 2007 back again ; I will start immediately The problem is that I have 3 different pages (classic, business and VIP) which links to the contact.php page and in these 3 pages there are 3 different banners, menu and footer. And in the (3) footer file there is one common link to the contact page what i did was from the Classic footer i passed this value <a href="contacts.php?frompage=Classic" class="bottom_link">contact</a> and from the business footer i passed this <a href="contacts.php?frompage=Business" class="bottom_link">contact</a> and from VIP footer i passed this <a href="contacts.php?frompage=VIP" class="bottom_link">contact</a> and in the contacts.php page i did this <?php $mypage = $_REQUEST['frompage']; ?> and from this variable i managed the header, menu and footer <?php if ($mypage=='Classic') { include("includes/header_classic.php"); } elseif ($mypage=='Business') { include("includes/header_business.php"); } elseif ($mypage=='VIP') { include("includes/header_vip.php"); } ?> same code follows for menu and footer But what happened is when i Submit the form and save the information in database (all the values) gets saved, the header, menu and the footer gets lost... I know because while submitting $mypage variable gets blank and due to this the headers are not showing, how shall i retain the value from this variable while i submit the form or the page refreshes.. Please someone help... Quote Link to comment https://forums.phpfreaks.com/topic/71809-passing-values-really-annoying-me/ Share on other sites More sharing options...
jscix Posted October 4, 2007 Share Posted October 4, 2007 You'l most likely need to use sessions, I don't know what your doing .. how-EVER, It looks to me like you are giving your users alot of control by passing Access Restrictions in the URL Bar. Users can change these values, which is a potential security risk. I would save the users access level in a session variable.. that way you won't need to worry about passing variables around so much, only initially.. If you need help with this, just respond back.. I will give ya plenty of info if your willing to read. Quote Link to comment https://forums.phpfreaks.com/topic/71809-passing-values-really-annoying-me/#findComment-361641 Share on other sites More sharing options...
~n[EO]n~ Posted October 4, 2007 Author Share Posted October 4, 2007 Ok, yes i hadn't thought of that , but for now can you suggest how to save these names. Using Session is also not working <?php $mypage=$_REQUEST['frompage']; $_SESSION['currpage'] = $mypage; $mynewpage = $_SESSION['currpage']; ?> I tried this also but does not work, <form name="frmcontact" method="post" action="contacts.php?frompage=<?=$mynewpage?>"> <input type='hidden' name='co_usertype' value="<?=$mypage;?>"> BTW, i will be glad to read your info, but please don't give a link to the websites. Thanks a lot.... Quote Link to comment https://forums.phpfreaks.com/topic/71809-passing-values-really-annoying-me/#findComment-361649 Share on other sites More sharing options...
jscix Posted October 4, 2007 Share Posted October 4, 2007 Well I'm gonna ask the obvious just to make sure -- You do have Session_Start() as the very, very, first thing on your page right? If so, that should be working. Quote Link to comment https://forums.phpfreaks.com/topic/71809-passing-values-really-annoying-me/#findComment-361650 Share on other sites More sharing options...
~n[EO]n~ Posted October 4, 2007 Author Share Posted October 4, 2007 No don't have to do that cause it gets automatically started and it is done config.php file here some codes from config.php file <?php //========config.php========================== // application global configuration constants. //------------------------ // intialize environment session_name("sitename"); session_start(); set_magic_quotes_runtime(0); //error_reporting(0); // set default content type and encoding header('Content-Type: text/html; charset=utf-8'); $path=realpath("./"); if(strpos($path,"admin")>0) $rootpath=realpath("../"); else $rootpath=realpath("./"); define('INCLUDES_DIR',$rootpath.'/includes/'); define('CLASS_DIR',$rootpath. '/classes/'); <?php require_once("config.php"); require_once("user_info.class.php"); ?> cause in the user login page i haven't called Session_Start() and it is working fine... Quote Link to comment https://forums.phpfreaks.com/topic/71809-passing-values-really-annoying-me/#findComment-361654 Share on other sites More sharing options...
jscix Posted October 4, 2007 Share Posted October 4, 2007 Ok, Then ... In your footer, after the user follows the link to: contact.php?frompage=business and in your contacts.php, you have: $_SESSION['var'] = $_GET['frompage']; ------------- print $_SESSION['var']; This should print 'business', does it? Quote Link to comment https://forums.phpfreaks.com/topic/71809-passing-values-really-annoying-me/#findComment-361659 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.