PHP - Using Varables Across Php Pages
I want to use my form variables in other page which is not specified in action attribute. Please help me out !!! My code is below :
<body>
Similar Tutorialslike if I'm displaying a hundred entries , my website will be super long in length so I wanna break those hundred entries into maybe like 12 per page . Then click next page or the page number to view the next 12. hi guy's i have on one page select from table, and i don't know how to limit showing content from database on 3, and rest to make number under it and when i click on that number next 3 is showen? Something like on forum when you have more topics then you can show, on botom of page are showen numbers (links). Can some explain me how to do this? i put in while loop something like this Code: [Select] while ($prom = mysql_fetch_object($res) and $i<3) and now it is limited on showing first 3, my problem is showing next 3, and if there is more how to split it on 3 per page? Hi, (Just wanna say thanks to the guy who helped me earlier as i cannot find the topic) I have a game, it has 3 frames, menu, header & the main content, it WAS fine until i deleted a 4th frame, now when i click a link from the menu, instead of showing the link in the 'Main' content area, it takes you to the actual page with no menu, header etc. Thanks in advance! Hi, can someone help me to understand this? What i want to do is to write some information in a form and after i submit the form that data will be in a new php page. Thanks in advance Hello everyone, I am new to this site and new to working with php. I am wondering about a code that i could use for splash pages for members to be able to use them. I have the splash pages set up already but have not been able to figure out how to code it so that all the members of the site can use them to promote the site. Any help would be great thanks. Aaron Hi, so....i have these 2 pages, but they don't show up in browser....can't find the error so will ask your help guys index.php <?php session_start(); if(!isset($_SESSION["manager"])){ header("Location: admin_login.php"); exit(); } //Be sure to check that manager SESSION value is in database $managerID = preg_replace('#[^0-9]#i',",$_SESSION["id"]); // Filter everything but numbers and letters $manager = preg_replace('#[^A-Za-z0-9]#i',",$_SESSION["manager"]); //Filter everything but numbers and letters $password = preg_replace('#[^A-Za-z0-9]#i',",$_SESSION["password"]); //Filter everything but numbers and letters //Run MySQL query to be sure that this person is an admin and that their password session var equals the database //Connect to the MySQL Database include("../storescripts/connect_to_mysql.php"); $sql = mysql_query("SELECT * FROM admin WHERE id='$managerID AND username='$manager' AND password='$password' LIMIT 1"); //search user $existsCount = mysql_num_rows($sql); //count the row numbers if ($existsCount == 0){ //evaluate the count header("Location: ../index.php"); exit(); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>MyOnlineStore | Admin Area</title> <link rel="stylesheet" href="../style/style.css" type="text/css" media="screen"/> </head> <body> <div align="center" id="mainWrapper"> <?php include_once("../template_header.php");?> <p><br /> <br /> </p> <p> </p> <p><br /> </p> <div id="pageContent"> <div id="admin" align="left"> <h3>Hello what you want to do?</h3> <p><a href="#">Manage Inventory</a><br /> <a href="#">Manage afggagdfag</a></p> </div> </div> <?php include_once("../template_footer.php");?> </div> <p> </p> <p> </p> <p> </p> </body> </html> admin_login.php <?php session_start(); if(!isset($_SESSION["manager"])){ header("Location: admin_login.php"); exit(); } //Be sure to check that manager SESSION value is in database $managerID = preg_replace('#[^0-9]#i',",$_SESSION["id"]); // Filter everything but numbers and letters $manager = preg_replace('#[^A-Za-z0-9]#i',",$_SESSION["manager"]); //Filter everything but numbers and letters $password = preg_replace('#[^A-Za-z0-9]#i',",$_SESSION["password"]); //Filter everything but numbers and letters //Run MySQL query to be sure that this person is an admin and that their password session var equals the database //Connect to the MySQL Database include("../storescripts/connect_to_mysql.php"); $sql = mysql_query("SELECT * FROM admin WHERE id='$managerID AND username='$manager' AND password='$password' LIMIT 1"); //search user $existsCount = mysql_num_rows($sql); //count the row numbers if ($existsCount == 0){ //evaluate the count header("Location: ../index.php"); exit(); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>MyOnlineStore | Admin Area</title> <link rel="stylesheet" href="../style/style.css" type="text/css" media="screen"/> </head> <body> <div align="center" id="mainWrapper"> <?php include_once("../template_header.php");?> <p><br /> <br /> </p> <p> </p> <p><br /> </p> <div id="pageContent"> <div id="admin" align="left"> <h3>Hello what you want to do?</h3> <p><a href="#">Manage Inventory</a><br /> <a href="#">Manage afggagdfag</a></p> </div> </div> <?php include_once("../template_footer.php");?> </div> <p> </p> <p> </p> <p> </p> </body> </html> Hey all, I've a problem with including of my pages. When I do choose lotto on index.php , I do get the page and also can choose how many roster I want. But I can't see my lotto results, because it does refresh to the index.php again. How can I fix this problem ? this is the code of index.php: Code: [Select] <?php echo '<table class="achtergrond" border="1">'; echo '<tr><td colspan="3">'; /* Keuzelijst tonen */ echo '<center><form action="'.$_SERVER['php_self'].'" method="POST"><select name="test">'; echo '<option selected>Kies een formulier</option></center>'; echo '<option value="1">Lotto</option>'; echo '<option value="2">Euromillions</option>'; echo '</select>'; echo '<button type="submit" name="knop">OK</button>'; echo '</form>'; echo '</td></tr>'; /* Als er op de knop gedrukt is , voer het lottoformulier uit*/ if(isset($_POST['knop'])) { echo '<tr><td>'; echo $waarde; /* variabel $waarde een waarde insteken via keuzelijst */ switch($_POST['test']) { case 1; include('formulieren/lotto.php'); case 2; include('formulieren/euromillions.php'); } echo '</td></tr>'; echo '</table>'; } ?> and this is the code of lotto.php: Code: [Select] <?php echo '<table class="achtergrond">'; echo '<tr><td colspan="3">'; /* Keuzelijst tonen */ echo '<center><form action="'.$_SERVER['php_self'].'" method="POST"><select name="lotto">'; echo '<option selected>Kies aantal rooster</option></center>'; echo '<option value="1">2 roosters</option>'; echo '<option value="2">4 roosters</option>'; echo '<option value="3">6 roosters</option>'; echo '<option value="4">8 roosters</option>'; echo '<option value="5">10 roosters</option>'; echo '<option value="6">12 roosters</option>'; echo '</select>'; echo '<button type="submit" name="knop1">OK</button>'; echo '</form>'; echo '</td></tr>'; /* Als er op de knop gedrukt is , voer het lottoformulier uit*/ if(isset($_POST['knop1'])) { /* variabel $waarde een waarde insteken via keuzelijst */ switch($_POST['lotto']) { case 0; $waarde2 = 0; break; case 1; $waarde2 = 1; break; case 2; $waarde2 = 2; break; case 3; $waarde2 = 3; break; case 4; $waarde2 = 4; break; case 5; $waarde2 = 5; break; case 6; $waarde2 = 6; break; }... Hello everyone, this is my first post. This isn't just a simple post and leave, I'm looking to expand into this community and learn as much as I can. Well on to the problem at hand! I decided to start with something simple as a login page and now want to expand it to make it fully functional. Code: (index.html) [Select] <html> <head> <title>Deadnode.com</title> <LINK href="style.css" rel="stylesheet" type="text/css"> </head> <body> <div style=width:150px;height:80px;position:absolute;left:40%;top:35%; margin-left:-135px;margin-top:-50px;"> <div class="sidebox"> <div class="boxhead"><h2>Login Required</h2></div> <div class="boxbody"> <form method="post" action="check.php"> <center><table> <tr><td><font face="verdana,arial" size=-1>User:</td><td><input type="text" name="user"></td></tr> <tr><td><font face="verdana,arial" size=-1>Pass:</td><td><input type="text" name="pwd"></td></tr> <tr><td><font face="verdana,arial" size=-1> </td><td><font face="verdana,arial" size=-1><input type="submit" value="Login"></td></tr> </table></center> </form> </div> </div> </body> </html> Code: (function.php) [Select] <?php function check() { $admin="test"; $pass="test"; if ( $_POST["user"] == $admin & $_POST["pwd"] == $pass) { header('Location: output.php'); } else { header('Location: index.html'); } } ?> Code: (check.php) [Select] <?php require('function.php'); check(); ?> This is just the code in it originally form; completely functional. I tried to use start_session() in my check() function. I know I should be using cookies, but I haven't gotten that far yet. Is it possible to use my check function as a way to block pages? I tried inserting the same code that is in check.php onto a html page, but I've had no luck with it redirecting back to my index.html page. Hi, Im trying to make pages switch. Read data from database and but every 10 data in 1 pages. I got my way on making pages by using PHP, but my way is not efficient. Please teach me and tell me the correct way or concept to do it. Or is there any website teaching this? Appreciate for the help thanks. How can I go about making dynamic pages? eg. user types "phpfreaks.com/index.php?page=name" Hi everyone, I would like to put up online exercices wth answers. These exercices and answers should only be visible 1 by 1. E.g. you start with Q1, submit yr answer and then you would see the answer. Then push next Q button and the former Q dissapears. How do I put everything in 1 srcecode, 1 php file? Thnx Hey, i was wondering if anyone knew how i could make a script so when i register a new account... There will be made a link in members.php and when you go there you see the new registered (and the old ones) name... And once you click it you get into their page (their page should be created when registering a new account). Im pretty blank how to do it so ill ask you guys :/ Hi, I hope someone can help. I currently have a page that includes the main page after login, however I am looking into changing this so that when a user logs in they get 3/4 linked images that, when clicked dynamically load/include the page based on the select i.e. user selects the image laptop, that has a hyperlink, it loads the laptop page. If anyone has any ideas or suggestion,i'd appreciate it. how to convert php pages to api Hello, I was wondering if someone could help me to "get" the webaddress of a current webpage and then pull off pieces of the page. All of my pages look like: http://localhost:8888/algebra_book/Chapters/Quadratic_Functions/introductory_problem.php BUT, the stuff to the left of Quadratic Functions WILL change in the future. So all will look like: *Quadratic_Functions/introductory_problem.php Then, I'd like to pull off a $chapter variable, which in this case is Quadratic_Functions and a $page_name variable which in this case will be introductory_problem. Thanks so much. Hi, I am looking for reliable, effective code to cache one or two of my website webpages. I know there are packages like the pear cache lite but is far beyond my needs and complex in terms of never used pear before etc. I am looking for a good cache class perhaps or a link to a good cache script. Does anyone have any code they would like to share or know of any good cache classes etc? I want to keep it relatively simple if possible. Thanks for any suggestions, help. PHPLOVER what I'm trying to do is to setup a page called settings.php that the admin runs to order to turn option in the web site on or off. I don't know how to do this since I never done this before. My code is below. <link href="mainframe.css" rel="stylesheet" type="text/css"> <?php require_once '../config.php'; $db = new DbConnector(); $db->DbConnector(); if(isset($_GET['submit'])) { $db->query('UPDATE '.SETTING_TABLE.' SET option='.$_POST['banner'].' WHERE setname='''); echo 'Process complete'; } $result = $db->query('SELECT * FROM '.SETTINGS_TABLE); echo '<table border="1">'; echo '<tr>'; echo '<form action="settings.php" methed="post">'; while($row = $db->fetchArray($result)) { echo '<tr>'; echo '<td>'.$row['setname'].'</td><td><select size="1" name="'.$row['setname']'">'; echo '<option value="on">on</option>'; echo '<option value="off">off</option>'; echo '</td>'; echo "</tr>"; } echo '<td><input type="submit" value="Submit" name="submit">'; echo '</td>'; echo "</tr>"; echo "</form>"; echo "</table>"; /* */ ?> <h2>Settings</h2> <a href = "admin.php">Admin Panel</a> If i have a page that requires people to be loged in to view it. and If that page requirs a function page (with only php code on it) does that function page need to have the same safe file on it to keep people from going straight to that function page? or would it not matter Hi Mates, I want to know how to create auto generated pages in submit button with the existing templates...Wordpress users may easily understand what actually i mean...i am using the code that is creating a page but not getting the desired page name and giving a blank page that is without any formatting... Code: [Select] <?php $content = <<<EOL <head> </head> <body> New page EOL; include ('config.php'); mysql_select_db("$db_name"); $result = mysql_query("SELECT * FROM text ORDER BY ID") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { echo $row['title']; echo "<br />"; } $content .= <<<EOL </body> </html> EOL; $file = '$result' . '.php'; $open = fopen($file, "w"); fwrite($open, $content); fclose($open); ?> Hello everyone, I am not a php programmer, but I would like to solve a problem regarding math with PHP. I was looking around on the web on how to add (in this case digits) using PHP. I found out that adding two strings using a . I can then echo out the results; so far so good. My question however is as follow. How do I add up information from multiple pages? Let's say on one page (let's call it weekly.php) I have my weekly expenses of $300, and on the second page (let's call it monthly.php) I have my monthly expenses of $1400. I would like the result (weekly + monthly) to be displayed (echo'ed out) on the third page (let's call it totalamount.php). I don't want to take advantage of anyone's time, so I am not asking for the entire solution (code) unless you want to , but I would be just happy to be pointed in the right direction, I will do the rest on my own. Thank you very much for your time. Cheers, Luigi |