Session Var Is Setting ONLY AFTER I Reload Page, Form Var Displays First Page Load
Page1 has a form that calls Page2. The beginning of Page2:
<? php session_start();
$s=$_POST['sSelected'];
session_register("s"); ?>
in the middle of Page2 I have a form varaible:
<?php echo $_POST['stateSelected']; ?>
<?php echo $_SESSION['s']; ?>
The form var displays the first time the page loads. The session var
displays only after reloading the page2.
View Complete Forum Thread with Replies
Related Forum Messages:
Session ID Changed Everytime Go To New Page Or Reload.
I'm new member of this group. I had added new virtual host at my intranet server. The new virtual host configuration on httpd.conf is similar with the old one. At the new virtual host, the session id seems changed every interaction to server (new page or reload). The old one is fine, the session id keeps at the same string. Both are at the same server. I use Apache 2.2.3 (Win32) with PHP 5.2.0. Tested using code below: session_start(); echo session_id(); PHP Configuration : session.save_handler = files ;session.save_path = "/tmp" session.use_cookies = 1 ;session.use_only_cookies = 1 session.name = PHPSESSID session.auto_start = 0 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = session.serialize_handler = php session.gc_probability = 1 session.gc_divisor = 1000 session.gc_maxlifetime = 1440 session.bug_compat_42 = 0 session.bug_compat_warn = 1 session.referer_check = session.entropy_length = 0 session.entropy_file = ;session.entropy_length = 16 ;session.entropy_file = /dev/urandom session.cache_limiter = nocache session.cache_expire = 180 session.use_trans_sid = 0 session.hash_function = 0 session.hash_bits_per_character = 5
View Replies !
$_SESSION Problem - Page Reload Creates New Session ID
I am having trouble using the session vars in PHP 4.3.9 OS: Win XP Prof Web Server IIS (is local and there are no links to other servers from the web pages I work on) Browser: IE 6.0 The problem I am having is that each time I reload the same PHP page, I get a different Session ID (and thus all session vars are lost from one page to another). let's say in firstpage.php I set $_SESSION["firstvar"] = "someval"; $_SESSION["secvar"] = "otherval"; and in secpage.php I try to retrieve $_SESSION["firstvar"] , it gives me "Undefined Index error" I did not know what is happening and when printing out the session id (echo SID;) I found out that the ID is changing every time page is reloaded or when moving to another page. The problem is that I don't know what might reset the session since I use "session_auto_start" and have not played with session_start, session_destroy or anything else.
View Replies !
Can Header() Do A Div Reload Without A Page Reload (ie Ajax-type)?
I have a display page (displaypage.php) divided into two panes - one for content and one for feedback, referred to in the CSS as contentDiv and feedbackDiv respectively. When I click on a word in the content pane, I do a PHP/PostgreSQL search for similar words, and the results appear in the feedback pane without a page reload. For this, I am using a very basic Ajax setup Code:
View Replies !
Setting A Session To Store User's Last Page Visited?
I have the following code that sets a session to return the user back to the previous page they were on. $_SESSION['last_page'] = (!isset($_SESSION['curr_page'])) ? "http://www.mydomain.com/page1.php" : $_SESSION['curr_page']; $_SESSION['curr_page'] = $_SERVER['PHP_SELF']; Bascially I am looking for a better way to do this. The problem with this is you need to hard code what the previous page was. Is there anyway to dynamically set what page the user was on. What if the last page URL had an id in it like... http://www.mydomain.com/?id=14 How could I set this as the previous page in a session?
View Replies !
PHP Form Processing Hangs Page Load
I am trying to write a simple PHP script to process a form.. the function seems to be working fine // subscriber is the users email in the form if (( $subscriber ) && ($_SERVER['REQUEST_METHOD'] == 'POST') ) thing is while this processing is taking place the page load hangs... in IE i see nothing the page background, in Firefox (even worse) I get only 1/2 the page.... I would like the whole page to load the the processign to take place, except that my PHP is 1/2 way down the page, inside the form
View Replies !
Auto Submit Form On Page Load
i have a cronjob to run a php file at a certain time of the day. it originally was suppose to run the php mail function, easy enough, right?? but no, the php mail function is not enabled on the server - just my luck. all i need to do is send two values from a database table within an email. i was thinking, i could probably create a form which plugs the two values into fields, and use the mail cgi file to send it that way, but I'd need to submit the form on page load (without someone actually clicking the submit button). I could use javascript, but the cronjob would ignore the javascript. any ideas?
View Replies !
Cookie - Page Load Or Page Refresh
this is supposed to show file1.txt, then file2.txt and so on on page load or page refresh. But it only shows the first 2 txt files. Can someone help me find out why? I would think that as long as the cookie is still the same if (isset($_COOKIE['e'])) { setcookie("e", $a++, time()+60*60*24*30);} that it would go to the next text file but its not. Please let me know, thank you very much. <?php $max_files = 12; $a = 0; if($a == 0) {setcookie("e", $a, time()+60*60*24*30);} /* expire 30 days*/ if (isset($_COOKIE['e'])) { setcookie("e", $a++, time()+60*60*24*30);} if ($a == $max_files) $a; $include_file = "file" . $a . ".txt"; include ($include_file); ?>
View Replies !
Page Reload
I have succesfully created a login page for my site. I have used the PHP_SELF so that once the user has succesfully logged on the page reloads. Everything works fine the first time somebody tries to log in but when they revisit, the log on page is bypassed and it goes straight to the information page. I have a sneaky suspicion that this is due to the fact that the page is then in their history of recently visited sites. How can I use PHP to refresh the page automatically everytime it is requested?
View Replies !
Reload Page On Die
I have a query that seems to fail about one out of five times, resulting in a completely blank page. Here's the query and the call to it (which appears before any HTML is displayed): PHP Code: $query = "SELECT msg.id, msg.to, msg.from, msg.subject, msg.date,   u1.first_name as to_first, u1.last_name as to_last,   u2.first_name as from_first, u2.last_name as from_last FROM messages msg, userprofiles u1, userprofiles u2 WHERE msg.read = 'n' AND u1.id = msg.to   AND u2.id = msg.from AND msg.to = '$userid' ORDER BY msg.date DESC"; $reslt_message = mysql_query($query, $conn) or die(mysql_error()); If there is anything wrong with this query, please let me know. Otherwise, assuming that the query is ok, would it be wrong (or even work at all) to put a header inside the "die" that reloads the page, or would that be bad practice? I can see the possibility of getting an infinite loop, but that could be remedied by adding a variable to the end of the header that would force the code to reload only if it hasn't reloaded yet. if that is clear. When the page crashes, refreshing it works. If I click the link to this page 10 times, it could be the 1st or 10th time that results in a crash, so I'm thinking that the query is ok but it is having trouble processing it or something, which is what led me to think about reloading the page.
View Replies !
Reload Php Page
I am creating (using php) an html page with many links. Clicking on a link open the link as _self. Clicking on the browser back button brings the prv html page (with the links,) but instead of getting it from the cache it will recreate it. how to avoid the re-creation of the php/html page and just to reload it from the cache.
View Replies !
Reload Page
I have a form which is used to add / edit records in a mysql db. This all works fine but after entering a record, and returning to a database view page, a user can hit reload page and a new record is added. Clearly, the previous $_POST vars are still in the system and thus reloading the page runs the same script to add a new record.
View Replies !
Reload This Page
I'm trying to create a cookie on the user's machine that includes the referral url. I then plan to call the data from the cookie in a script that is called on my thank you page to track sales. Why won't the following script work? It's writing "$_SERVER["HTTP_REFERER"]" to the cookie instead of the referrer URL. <?php $value = '.$_SERVER["HTTP_REFERER"].' setcookie("solvotrack", $value, time()+2592000); /* expire in 30 days */ ?>
View Replies !
PHP Script That Displays Another Page Partial Content
If you go to http://europe.nokia.com/A4305060, fill the "Enter your product code:" field with the value "0523183" and press "Go" (the ending page URL varies because there's a variable session-ID in the URL-link associated to "Go") you will obtain this string: "Version: RM43_V1.10.030" Is it possible to have a string.php page that just display this string?
View Replies !
Displays 5 Posts Per Page In Descending Order
I have been doing up a website which will, among other things, display news that I input into the MYSQL database. I have a working version of this where it just displays 5 posts per page in descending order (the latest at the top of the page) with the page numbering underneath them. Now what I wan't to do is just dispaly the latest 5 posts on the page but, I want to dispaly them so that I can put in a Javascript function to maxamize and minimize each post by clicking on the title. So, I have, ID, Title, Newstype, Author, Post, Date. In my mind I see this as display each of these using the COUNT(*) thing and just subtracting 1, 2, 3, 4 to get the 5 posts I want. I just don't know how to do it.
View Replies !
Using PHP To Load Another Page Or Html Page
Ive got a PHP script, which if it ends correctly, i want load another PHP file or an HTML page automatically, ie without user intervention. The new page shoud replace the current page on the browser. Is there a PHP command or function which does this?
View Replies !
Combo Box Value On Page Reload
I am new to php and mySQL so this is probably something very basic that I'm missing. Basically, on the page I have 2 combo boxes but 1 of them is not getting the value passed when the page is reloaded so the database can be updated. I am echoing the field names passed and the field "theDriver" is there but it's empty. I've include the code parts where I believe the problem should be but I'm stumped and I've been trying to solve this for 2 days without success. Would someone mind examing the following code and tell me what I've done wrong? Following code constructs the combo box on the page from a MySQL table: <?PHP $table = "tblEmployees"; $Link = mysql_connect ($host, $user, $password); $Query = "select concat(empID,' ',empFirstName,' ',empLastName) as full_name from $table WHERE empTitle = 'Driver'"; $results = mysql_db_query($database, $Query, $Link); ?> <b>Driver:</b> <select name = "theDriver" size="1"> <Option Value=" ">Select One:</option> <?PHP for($u=0;$u<mysql_num_rows($results); $u++) { $driver=mysql_result($results,$u,'full_name'); ?> <option value="<?PHP echo($ID); ?>"><? echo($driver); ?></option> <?PHP } ?> //end php </select> When Page is reloaded the following code is run but the combo box titled "theDriver" is empty foreach($_POST as $field => $value) { echo $field; //field names from form echo "; "; if ($field == "theDriver") { echo " - here's the driver for ya: "; $$field = strip_tags(trim($value)); echo $$field; $pos = strpos($driver, ";"); echo "<br> the ; is in pos $pos <br>";.......
View Replies !
Page Cache/reload
I have created a facility for users of a site to enter details of property (e.g. location, size etc.). This allows them to upload a picture. Users can also update a picture, adding a new picture to replace an existing one. My problem is that if a user changes/updates the picture and then views the details the old details are displayed unless the user manually clicks refresh. I know that this is because IE is storing the page in cache. I have tried the Meta Tags with "no cache" and "expires" but they don't work. I have also tried to get the page to refresh itself on loading, but it either doesn't work at all or keeps refreshing over and over again. Ideally i would like the page to just refresh once and then stop refreshing but there doesn't appear to be any way of doing this.
View Replies !
Refresh To Reload The Page
i was using header("Location: http://test.com/alt.php"); on my php page as a refresh to reload the page as i need to refresh the whole page but hold my sessions i set to rest the forms on it. but then i had to create a header redirection page in the website to have get the websites template page on the page i created for the menu logo etc. so turning the original page into a redirection to achieve this. So now my php page is in zen cart and is called in on the first the redirection nut when i try and use a second header location it doesnt work.
View Replies !
Page Reload With An <iframe>
Let me to explain the structure.... filename : api.php Having an <iframe src="remotehost/index.php"> </iframe> i have to reload current page api.php after some execution of remotehost/index.php ... I've tried header(); but got formal header error. can we reload current browser url from an iframed code?
View Replies !
Does 'Back' Reload The Page?
I notice that when I click the 'Back' button my previous script runs, i.e, all the php code runs (I previously thought that maybe the previous form displays without the code re-running). However, I do not get the expected value displayed on my form. After populating one element in formA with ཌྷ' (just any number) and submitting to formB (using POST ---> Redirect --> GET to avoid the 'expired from cache' message) I then click the 'Back' button and the 17 does not appear. In the code below, after clickng 'Back', I see as output from the echo statement that rb_value[0] is, infact, ཌྷ' but within the form, the text element named rb_value[0] displays as empty. Does anyone have suggestions why this might be? It might have to do with that I do not understand what the 'back' button does. Or maybe with my PRG (post - redirect - get) model. Here is part of the code: echo "rb_value[0]=".$rb_value[0]; //After clicking 'Back' I see that rb_value[0] is 17 if (isset($rb_value[0])) { $rb_val = $rb_value[0]; } else { $rb_val = 1; } $line.= "<td width="20%" valign="center" align="left"> "; // This element displays as empty instead of the expected 17 $line.= "<input type=text name="rb_value[0]" value="$rb_val" size="25" maxlength=25 </center> " $line.= "</td> ";
View Replies !
Increment ID In A Page On Reload
I have a page that has an iframe on it, PHP Code: <iframe src="index.php?u=<?=$ID?>" width="400"></iframe> What I need to do is on every page reload increment the $ID variable so I load the page 1 time then $ID = 1 new page reload $ID = 2 how can I do this?
View Replies !
Reload Same Page With New Query
how would I go about reloading the page with a new query by a click of a link. right now its loading everything from my table, SELECT * FROM usr_img; I want to be able to click a link and have the page reload with, SELECT * FROM usr_img WHERE img_cat LIKE 'Birds' Can anyone help me, im still learning php.
View Replies !
Resubmitted With Page Reload
I am using PHP5 and IE 6. I have made a web form. The action attribute of the form is redirecting it to the same page. Like action="index.php" and form name is also index.php . I am using Post method. When the user clicks on the submit button all the post variables are check by the isset function and then only the function to insert data is executed. If the user clicks on submit first time the data is submitted.
View Replies !
Script That Reads My Log File And Displays It In An HTML Page.
I have a problem. I am trying to make a script that reads my log file and displays it in an HTML page. I got the base code from a book, being that I am still learning PHP and I needed a little help starting out. But the code I am using gives me an error. The error is : Fatal error: Maximum execution time of 30 seconds exceeded in /home/sites/home/web/php-site/log-file.php on line 15 It ranges from to line like so : Fatal error: Maximum execution time of 30 seconds exceeded in /home/sites/home/web/php-site/log-file.php on line 27 I want to know if anyone knows the specific reason or maybe a place to start at to find out the problem and the solution.
View Replies !
Developing A Page That Displays Latest 5 Images In A Database
I am currently changing my web site so that it is PHP and mySQL powered. On the front page I have an area that will display the latest images in my portfolio and the latest text description. Therefore, what I need is an admin page which allows me to upload images to a database which has a timestamp/date field, a thumbnail field, an image field, a text field for the title and a text field for the description. I also need a HTML form with inputs for the thumbnail upload, image upload, title and text description (in a textarea). It would also be useful to have the page display the database contents and allow me to edit the details and also, delete rows. I then need code for that will display the most recent 5 thumbnails and the title on my index.php page.
View Replies !
Displays Page Will Not Parse Till The Sql Query Is Finished.
I had PHP 4.3.3 running before I updated. When a page was loading, all the php/html that was doing simple prints of tables and images would load while an sql query was running. When the sql finished, the rest of the page displayed. I have now updated to 5.2.3 and when I go to the exact same page, nothing displays until the sql has completely finished. The issue with this whole thing is the javascript I had loading on certain pages that displayed an image telling the visitor "please wait, processing..". This no longer displays since the page will not parse till the sql query is finished.
View Replies !
PHP Page That Displays Html Based On The Address Enterd
I would like to have a PHP page that displays html based on the address enterd. For example: index.php?example=a would show a page with <body>Example1234</body> whereas index.php?example=b would show a page with <body>Example5678</body>. I've done this before, but I can't remember the code I used.
View Replies !
MySQL Query - Page Which Displays A List Of Orders
At the moment I have a page which displays a list of orders, with the following query: Code: <?php mysql_select_db($database_connOriental, $connOriental); $query_rsOrders = "SELECT *, date_format(OrderDate, '%d %M %Y') as formatted_date FROM Orders INNER JOIN Customers WHERE OrderCustomerID = CustomerID ORDER BY OrderID ASC"; $rsOrders = mysql_query($query_rsOrders, $connOriental) or die(mysql_error()); $row_rsOrders = mysql_fetch_assoc($rsOrders); $totalRows_rsOrders = mysql_num_rows($rsOrders); ?> .........
View Replies !
Stop File Reload When Page Is Refreshed
I have a section of PHP code at the beginning of the page that loads a file which the user has specified in the form, on the same page. The problem is that everytime the page is refresh with the refresh button, the file loads. I want the file loading to happen only if the user has pressed the submit buttom.
View Replies !
Reload A Page After Execution Of A Mysql-query In Php
I am aware that this question might involve Javascript and MySQL. So far I haven´t found a suitable solution in JavaScript ng´s - maybe becauese php-programmers are more likely to come across the following problem: A script on my page relays a quite complicated query to a MySQL-server with mysql_query(...); The query works fine but takes very long - I usually have to wait for approx. 30 seconds before the query is returned from MySQL and the results displayed by php on a webpage. I´d rather have the results of the query written into a nice textfile and display a text like "Results are being retrieved" in stead of the actual results and have the page reloaded a f t e r the textfile has been updated. The newly loaded page then would obviously first check whether this very textfile has been updated or not and read out its contents in case it is has been updated less then let´s say two minutes ago. I hope I can make myself understood...:) My question is: what actual code (I am almost sure it must be JavaScript and not PHP) does PHP have to generate in order for the page to reload after the results are retrieved and stored in the textfile?
View Replies !
Reload Outside Page OnClick Of Submit Button
I'm using frames to create a "bookmark-like" page. You can enter a URL and it gets added to my database. I have two frames (leftFrame - to display bookmarks entered and mainFrame to show web page). I want the leftFrame to automatically refresh when the user enters a bookmark. As of now you must physically refresh the page to see the results. Here's my code:
View Replies !
Make Sure The Page Reload Doesn't Affect Stuff
On my website I'm making I have a lot of stuff that happens when you load a page. Information is sent using the url string. If a user were to refresh the page on a page where I gave his account a special bonus, he would receive the bonus again and again. How can I counter this? Is there something that $_SESSIONs can help me with? Is there a way I can change the extra PHP information in the url string and the form POSTED data to not be there if the user reloads the same page?
View Replies !
Preventing Multiple Data Insertion On Page Reload
I am developing a PHP-mysql database. It is noted that when the browser window is refreshed the data is inserted again in the database. unfortunately there is no unique keys that I can use to verify the existance of the data, so as to prevent the multiple insertion. Is there any other way to prevent it otherthan introducing another field for this purpose and verifying its existance?
View Replies !
Saving Selection In Drop-down Lists In PHP After Page Reload?
I can't find an answer to my quesiton anywhere. Given a drop-down list with USA states and other text fields I pass this information for further processing via PHP. If any of the required fields is empty, the PHP script would return an error and reload the form page asking to fill out those fields. All entered information is saved... except for the drop-down list selection. I tried to write a Javascript function which is echoed by PHP, but interpolation of PHP variables in the Javascript section gives a syntax error message in Javascript. The PHP script returns, e.g., an "AL" string for Alabama. Of course, I don't want to write PHP code for each option to make it selected.
View Replies !
Ensure My Post Vars Make It Through A Page Reload.
A few of my users are occastionally getting the above message for certain pages. Reloading the page then allows them to continue but the $_Post vars seem to be at least partially absent. 1) Is there anything I can do to see what is causing the "Page cannot be displayed" message? 2) what can I do to ensure my post vars make it through a page reload.
View Replies !
Drop Down Menu - Every A Value Of It Is Selected To Reload The Page And Submit That Value.
i have a drop down menu and i want every a value of it is selected to reload the page and submit that value. i'm using something like this: HTML Code: <select name="menu"> <option selected value="1">GENERAL</option> <?php while ($cat = mysql_fetch_array($q)) { $cid = $cat[0]; $cname = $cat[1]; echo "<option value='$cid'>$cname</option> "; } echo "</select>"; i tried using <select name="c" size="1" onChange="MM_jumpMenu('parent',this,0)"> but i got confused so i'm looking for an alternative way..
View Replies !
Page Expired After Going Back From Del. Pageto Form Page Where Comment Is Submitted..
i've made a submit comment form with php and mysql, the form has an action to itself with a hidden var like this: input type=hidden action=add When i delete a comment on the page i go to a page called delete.php3 and there is a link with a javaline which goes -1 back in my history.. When ive added a comment, the comments page contains action=add and when i delete a comment, i want to click on the link to go back to the comment page, but then, it doesnt work and it says: Page has expired. I wondered how to deal with this kind of problems........
View Replies !
Build A Page That Takes Form Data, Processes It In A Second Page
I'm trying to build a page that takes form data, processes it in a second page, then sends the user to a third,depending on data processing. On the second page, I am trying to get the page to have some sort of "Loading" message while the backend processes the data, but I can't seem to get anything to work. Does anyone know how I can get that Loading message to display?
View Replies !
|