otuatail Posted April 21, 2010 Share Posted April 21, 2010 Hi Is there a way I can get the name of the page that resulted in a submit. I have a code page and it would be good if I can keep all the code in one area and check which page was responsible and take apropriate action. TIA Desmond. Quote Link to comment https://forums.phpfreaks.com/topic/199243-previous-page/ Share on other sites More sharing options...
conker87 Posted April 21, 2010 Share Posted April 21, 2010 I think you can use $_SERVER['HTTP_REFERER']; However, it can be changed manually, so you'd have to be careful. You could also manually set your own variables to certain values depending upon the page. Can we see your code? Quote Link to comment https://forums.phpfreaks.com/topic/199243-previous-page/#findComment-1045702 Share on other sites More sharing options...
oni-kun Posted April 21, 2010 Share Posted April 21, 2010 The session can be set (Or if lazy cookie/GET/hiddenfield) but it would make more sense if you told us the scope of what you wish this for, example: <input type="hidden" name="submitter" value="<?php print $_SERVER['REQUEST_URI']; ?>"> ... print $_POST['submitter'] . "Submitted the form!"; Quote Link to comment https://forums.phpfreaks.com/topic/199243-previous-page/#findComment-1045706 Share on other sites More sharing options...
otuatail Posted April 21, 2010 Author Share Posted April 21, 2010 Ok thanks. The code I have created needs a lot of work and I want to encript the database tables better. What I have created is a CMS site for allowing a lot of juggling of page content. http://www.des-otoole.co.uk/cms/admin/ I realise it needs a lot more work. Quote Link to comment https://forums.phpfreaks.com/topic/199243-previous-page/#findComment-1045717 Share on other sites More sharing options...
conker87 Posted April 21, 2010 Share Posted April 21, 2010 We need the code, not the page where it's on. Quote Link to comment https://forums.phpfreaks.com/topic/199243-previous-page/#findComment-1045718 Share on other sites More sharing options...
otuatail Posted April 21, 2010 Author Share Posted April 21, 2010 This code page should handel difrent requests from pages including History.php <? include ("../CmsFunctions.php"); session_start(); Session_Init(); if(!isset($_SESSION['Page'])) { header('Location: index.php'); } $id = $_GET['id']; $Title = $_POST['Title']; $page = $_SESSION['Page']; if(isset($_GET['id2'])) { connectDB(3); $id2 = $_GET['id2']; $sql = "UPDATE Pages SET Current = '$id2' WHERE Page = '$page'"; $query = mysql_query ($sql); header('Location: History.php'); exit; } $x = $_POST['document']; // have to re-work tinyMCE $x = Stripslashes($x); $x = str_replace("'","''",$x); $x = str_replace('"','\"',$x); $x = str_replace('<p>','<br />',$x); $x = str_replace('</p>','',$x); $Direction = $_POST['submit']; $now = time(); $md5now = md5($now); connectDB(3); if($Direction == "Create New") { $sql = "INSERT INTO cmscontent VALUES ('' ,'$x', '$Title', '$now' ,'' , '$page' , '$md5now')"; $query = mysql_query ($sql); header('Location: History.php'); } if($Direction == "Overwrite content") { $sql = "UPDATE cmscontent SET Content = '$x' , Submitted = '$now' WHERE PIN = '$id'"; $query = mysql_query ($sql); header('Location: History.php'); } if($Direction == "Cancel") { header('Location: History.php'); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/199243-previous-page/#findComment-1045723 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.