Read Page To Variable
I have tried tons of functions but none works the way I want. I have a page foo.php. Then in that I set a couple of variables. Now, if I include foo.inc.php that file can use all of these variables. Code:
View Complete Forum Thread with Replies
Related Forum Messages:
Pass The Variable From 1st Page And Read It With Other Name On 2nd Page
I am new to this and learning slowly, but I was hoping someone could give me some quick advice on how to create a variable on one page and have it passed to another to be read as an ID for a mySQL database. I want to pass the variable "varRevID" from one page and have it read as "reviews_id" on the other. My database is pulling from just the first record and I would liek to designate from the pointing page which record to pull from.
View Replies !
Set The Session Variable To Read The Session Variable In The Next Page.
I have a PHP web app, that runs with Register global off. It sets $_SESSION variables that are used in other pages. The script works fine on my server that runs Apache2 and PHP 5.0.1. But when I move the scrip to my hosting company that runs , IIS and PHP5.0.2, they don't work. It seems that its not able to set the session variable to read the session variable in the next page. cvWhat should I be checking ? Has anybody faces this situation before ?
View Replies !
Read Environment Variable From PHP
I want to be able to read either an OS environment variable or an apache set variable from my PHP code. How would I do this? The reason I want to do this is so I dont have to hard code a directory for my configuration file lookup. So at the O/S I would have SYTEC_CONF_PATH=/var/opt/etc/ In the code I want a way to read this environment setting. I'd suggest having an include file that has this information. Any other suggestions for my usually java-orientated buddy?
View Replies !
Read *parsed* PHP File Into A Variable?
I have this strange including problem: I want to read a piece of HTML, residing in some file, into a variable, not echo it out. So far so easy - but now the HTML contains a line of PHP. And I wish not to get the PHP code into my variable but the parsed result, just like if the variable was a client ;-). I wish to keep the nice ?> ...<? HTML area (with highlighting in my editor), and therefore include etc. don't help because they would echo it out. heredoc also doesnt help (if this may come up to your mind). Is there anything I can do...?!! The problem sounds so simple... the more for such a great tool like PHP ... but... ?
View Replies !
-> How To Read A Form Variable Before Posting? <-
is there a way to read the content of a form variable before a POST? I have a form with a "duplicate" button which opens a new form with most of the fields filled with the values of the calling one. To do so, I pass the id of the form to be duplicated. Example: - I have a form with "Number = 1234567" in a "numform" edit field. - Duplicate has a href=/duplicateform.php?id=1234567 - then the "duplicateform.php" reads id with a GET['id'] This is easy as I come from a displayed form that retrieves its values via a SQL statement and with a specific "number" reference. Now, once I am in this new form, I have a save button to save all values, including the new "Number" the user would type in, say "22222222". The save process works correctly via AJAX and saves the record using a POST action. But then, I still have my "duplicate" button which should now point to href=/duplicateform.php?id=22222222 How can I get this 22222222 value from within the form itself? I have to get it from the "numform" field, but how can I do this? it would be something like href=/duplicateform.php?id=<?=[value_of_field_number]?> with value_of_field_number being the actual value of that edit field.
View Replies !
Use File() Function To Read A Variable Name, Not A Literal Name.
I know I can use the file() function to read a file into an array by providing a literal file name between single quotes: $lines = file('literal_file_name'); But, what if I want file() to use a variable name? $variable_file_name = "literal_file_name"; $lines = file($variable_file_name); Of course, that example won't work. But what will?
View Replies !
Is It Possible To Read ASP.NET Web Page In PHP?
Is it possible to read another web page in PHP? If is ASP.NET, the code would be ------------ WebRequest req=WebRequest.Create("http://www.microsoft.com"); WebResponse res=req.GetResponse(); StreamReader sr = new StreamReader(res.GetResponseStream()); String Output=sr.ReadToEnd(); Response.Write("The content is : " + Output); --------
View Replies !
Read A Web Page
i want to store(read) the contents of a "web page" into a file. how can i do it in PHP. Please help me. The web page contains a table. i want to fetch & store the contents of that table into a file.
View Replies !
Read Txt File And Pass Each Line As Variable In A Function
I'm designing a website that is update several times a week with a new gallery of images. Each set of images is stored in it's own directory with a page that generates a gallery and textually describes the images in the directory. I want to create a page that reads from a list of the image directories and dynamically generates a link to each gallerey, 10 to a page. something like this: directorylist.txt index.php reads directorylist.txt, places the first gallery listed at the top of the page, then 9 more links to the next 9 galleries. At the bottom of this page, links to the pages that contain galleries 11-20, 21-30, etc. I have already created functions that take the gallery ID and generate the links, I just can't seem to figure out how to read from the text file, then generate the links in my main pages.
View Replies !
Read A Web Page And Then Display
I'd like to read a webpage, the parse it and display a small part of it. Here is what I've tired. It isn't working. <?php $handle = fopen("http://www.yahoo.com/", "r"); $contents = fread($handle, filesize($filename)); echo $contents; ?>
View Replies !
Q: Read Text With VBA From A PHP Web-page
I created a page on our intranet that shows a number and that increases for every time the page is opened. It is similar to a visitors-counter. When I look at the page with Internet Explorer it works just fine. Now I want to read this web-page from a MS-Word macro and include the number as a company wide unique id in my MS-Word document. Unfortunately, the PHP script doesn't update the counter when I call it from my MS-Word macro. How can I force PHP to update my counter when I call it from a VBA macro? I am using the following code:
View Replies !
Read An HTML Page
It may sound kind of crazy, but I'm trying to see if there's a way php code can 'read' contents of a static HTML page and store the contents into a variable. Is it possible? If so, how?
View Replies !
Load Page Then Read
Is there a way to completely load the page of its HTML elements then read all those elements into a string? For example, I have a PHP page that get its HTML content from the database. I want that page to completely loads, ie., get the content from the database, then write all of that page's text and html elements into a string so I can modify it (ie. remove all the links) to display it in another page.
View Replies !
Read Previous Page Url
I have a query regarding browser url.Let me narrate the exact scenario which i need. I would like to expire my session when a person enters different url in the navigator bar other than my url and comes back to my url. For example if i visit example.com and then i type gmail in the same navigator bar and then move back to my url example.com through browserback button then i have to end the session of my client i mean he has no more access to my site. The same scenario is there for icicibank.com. I wanna the code using php and javascript.
View Replies !
Code To Read A Web Page
How can I read another web page in php. I tried: $url = 'http://www.yahoo.com' $contents = file_get_contents($url); echo $contents; but I get an error: The specified CGI application misbehaved by not returning a complete set of HTTP headers.
View Replies !
String Variable Read From Mysql DB + Echo = Newline Problem
Hi. I have this simple code: =========================================== ->Database query here (.. some code) $row=mysql_fetch_array($res); (...) $formatting2 = $row['formatting2"]; (..) //Echo variable from DB echo "$formatting2"; $formatting2 = "USERNAME: %1$s SERIAL: %2$s"; //Echo same string - this time from an "inline" variable echo "$formatting2"; =========================================== Ok, maybe that was overly complicated. I hope you follow anyway. Whats happening here is that I am getting a formatted string from a database which I throw in a variable. What you see here is my test case to visualize the problem. Now, when I echo this variable or pass it to printf/sprintf then I get a different result than if I "manually" create the variable inline in my php script. So, the first echo $formatting2 there will output: USERNAME: %1$s SERIAL: %2$s whilst the second shows the newlines correctly. Also printf/sprintf barfs if I pass the string I got from the DB. What the heck is going on here? Database returning some strange string format?
View Replies !
Passing Variable - Make Read A Two Files, And Create A New File
I have a small script with a form, and if the form is submited (goes back to the same script) that it will make read a two files, and create a new file, and move it to a different directory. Everything works except, I'm trying to change one part. When I insert $header3 = "<?php $title = $header ?>"; Then I add that to another variable $data = "$header3 $top $header2 $info2 $bot "; Then I write that to the file via: if (!$file_handle = fopen($filename,"w+")) { echo "Cannot open file"; } if (!fwrite($file_handle, $data)) { echo "Cannot write to file"; } echo "Successfully written data to $filename!<br>"; ...................
View Replies !
Read Data From External Page?
I have tried to think of a solution to this problem, but i can't find it. My question is: If possible, how do you from your own page confirm that a form has been send from an external page?
View Replies !
Page Not Read By Conditional When In Sub Folder
I'm using some php conditionals in included footer. I identify some pages at the top with - $page='alt_footer' then have a conditional in the footer.php, like - if ($page!='alt_footer') { All works great, but if I put the page in a sub directory (making path adjustments for the includes), it is not recognized as having $page='alt_footer' All path relationships between the page (in sub folder) and the includes (in folder at same level as sub folder) work fine, just the conditional (from the include to the page) is not recognized.
View Replies !
Can't Read Remote Web Page From Local Apache/PHP
I'm trying to read the contents of any Web page on another host. I'm finding that... echo file_get_contents( 'http://www.php.net' ); .... works fine if I upload the PHP script to my Web host, and run it there. But if I run it on my PC, which is running Apache 1.3.33 (Win32) and PHP 5.0.5, then it always times out, and gives me the error message... [error] PHP Warning: file_get_contents(http://www.php.net) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. I get the exact same results using... $fh = fopen( 'http://www.php.net', 'r' ) or die( $php_errormsg ); while (! feof($fh)) { $page .= fread($fh,1048576); } fclose($fh); echo $page; Anyone know what could cause this to happen?
View Replies !
Read The Page Of The Site & Rerturn The Contents Of MEMBERS_URL & MEMBERS_NUMBER
a line on my site reads MEMBERS_URL="my2ndsite.com" MEMBER_NUMBER="12345" . Im Trying to read the page of the site & rerturn the contents of MEMBERS_URL & MEMBERS_NUMBER, but i cant get it to work can anyone suggest where ive gone wrong please PHP Code: $myfile = file("http://www.mysite.com"); foreach ($myfile as $row=>$data) { if (preg_match('/MEMBERS_URL="(.*?)" MEMBERS_NUMBER="(.*?)"/',$data)) { echo $data[1]; echo $data[2]; } }
View Replies !
Email With Attachment - Annot Be Accessed. The File May Be Read-only, Or You May Be Trying To Access A Read-only Location.
It is a basic email with an attachment. The email and attachment are getting sent and received ok. When the recipient tries to open the attachment, the right application opens (eg. Excel) but then throws up an error. I am using base64 encoding. For example: .xls file with base64 encoding: 'testing.xls' cannot be accessed. The file may be read-only, or you may be trying to access a read-only location. Or, the server the document is stored on may not be responding. .pdf file with base64 encoding: There was an error opening this document. The file is damaged and could not be repaired. so the file isn't being decoded right. I have tested on Yahoo and Outlook. PHP Code:
View Replies !
Fgetcsv Returns False In Dynamic Read Vs. Hard-coded Read ??
I am working with directories in PHP for the first time. I have code that I've changed multiple times to try different things. I would think this is pretty standard fare so I'm not sure why I can't seem to get it right. What I would like to see happen: The code opens the directory and loops through the files, opening them and processing them. What is happening: If I hard code the name of one particular file (it is always the same file) in my test setting, fgetcsv does not return false and the code runs fine. The file is parsed and all is well. However, if I let the code open a directory and then loop through the files, this one particular txt file does not work. For debug purposes, I have it displaying each file name and it can display the name, it just won't process it. I've even tried setting a for loop and hard coding each file name (since right now I know the names - I won't in the future) and the file is processed. It is only when it is set to my $file var dynamically rather than being hard coded. Here is the code: $handle_dir = opendir('../directory_name'); /* loop over the directory. */ $countfile=0; while (false !== ($file = readdir($handle_dir))) { $countfile++; $filevalues = ""; //Skip the first two files that where found because they are "." and ".." if ($countfile 2) { //echo $file; //begin loop through each file name $handle = fopen($file, "r"); echo "Filename is: $file<BR>";//at this point the code can print the file name if (false == ($filevalues = fgetcsv($handle,6021,','))){ echo 'problems<br>'//for one particular file, this always displays }
View Replies !
Read (and ONLY Read) A Multi-sheets Excel File With PHP.
I want to read (and ONLY read) a multi-sheets Excel file with PHP. I found so many scripts on the net that I finally don't know what to choose so... could experimented users help me to directly find the one that I need ? Here are the two obvious things the script must match : - free - can read multi-sheets Excel files
View Replies !
Question About Using "global" On One Page Then Using The Variable On Another Page
I am taking over an exisitng app. I have the following function on one page: function check($v) { global $user; return $user->validate($v[1], $v[0]); } And it reference $user on the next page. Register_globals are set on the existing server but I am moving to a new server where it is not. The code of the next page is lilke: session_register('user'); $user=$_SESSION['user']; I also want to turn it around so it's: $_SESSION['user'] = $user; But that fails - $user is empty. By the way, $user is an object. Any ideas to how to make sure: $_SESSION['user'] = $user;
View Replies !
How To Read Up To A Point And Assign The Read Value To An Array.
Open a text file which will look something like this: QuoteLink 1 http://www.blahblah.com/1651561 Link 2 http://www.etc.com/34324 Link 3 http://www.sdfkjsdf.com/12343423 basically its a "Link n" text followed by a URL text in the format of "http://www.page.com/random numbers" What I would like the php script to do is to read "Link n" text and output it with the a http link to the URL which follows it. That is it should look something like this in the output: Link 1 Link 2 Link 3 I have learned how to read a text file with php so far but I have no idea how to make it read up to a point and assign the read value to an array.
View Replies !
Page Name Variable
I have some code that returns content based on the page name, e.g. index.php gives me main page content. The trouble with this is that it works ok if www.example.com/index.php is the uri, but when only www.example.com is typed in the address bar then the php doesn't have a uri to fill in the filename variable. Here's what I tried: if ($_SERVER["REQUEST_URI"] == "") $filename = "../index.php"; else $filename = ".." . $_SERVER["REQUEST_URI"]; The funny thing was it worked the first time I tried it, but hasn't since.
View Replies !
Page Variable
I would say I am new to PHP, but I know a little. I built a who site using it. I am working on tulsalock.com and I am having trouble. Php is only used to designate pages. ?page=2 But for some reason those links are not working. I imported a page I knew worked on a different server, and it does not work on this one. Those pages are index2.php and educaton.php. Education is the one that should work.
View Replies !
[HELP PLEASE] Passing Variable To New Page
I am having hard time passing the variable to the next page. May be you can help me. Let me explain: I am using mySQL database to store information about images (ID, name, author, description, etc). I am pulling some of the information to create this (look at the example here: http://www.gibsonusa.com/test/page/index.php) Now, I want a new window appear when user clicks on the image. I have achieved it with the following script: echo "<script language="JavaScript">"; echo" function pop1() {"; echo" window.open("info.php?prod_id=$result[0]"); }"; $result[0] is variable that stores id of the image in database echo "</script>"; I am calling this function in the following manner: echo"<img onclick="pop1();""; You can see the result if you click on the image. The new page opens up, BUT the id (product_id in this case) value is not passed to the next page correctly. If you click on the first or second image on the first page it shows that the ID is the same for both of them. However if you look at the source code you can see that the ids are assigned correctly. The same thing happens if you click on any image that says “no image available” (I am using different script to generate those). It seems that the script picks up and stores in the memory the value of an ID of the last image generated with the script (I don’t know if that make sense). Oh, by the way the contents of info.php that I am calling in the script above are as following: <? $myid = $_GET['prod_id']; echo" Product ID: $myid<br>"; ?> What am I doing wrong? Can you help? Thank you.
View Replies !
Passing A Variable To A Page
Is it possible to pass a varialble to a page using just PHP/HTML. The object is to create a agenda page, with information comming from MySql, based on the choise of month in the index page in a different frame, i.e. the month is selected in frame 1. Now i want to sent the choice of the user to a page, to be shown in frame 2, that is created with PHP, and use the variable in the MySql query.I know this can be done using java, but i would like to avoid that.
View Replies !
Include Page Into A Variable
I'm trying to automatically generate an email that includes information from a few different pages on my site. I'm creating a variable $message to contain the email output. I would like to set the variable with html and then include a webpage inside the variable then echo the variable $message. i.e. $message = " <html> <body> Stuff in here but somehow include('cal_events.php') </body> </html>"; mail("someone@somewhere.com", "Subject", "$message","header info"); Can I get the informaion from an included page into the $message variable?
View Replies !
Include Php Page With Variable
I don't know if this is possible but I want to include a page with a variable. Like: <?php include('somepage.php?variable=whatever');?> How ever this gives me error (cannot be opened)Is this possible?
View Replies !
Passing More Than One Variable To The Next Page?
I've got a page with product info on it. The same page also has a recordset of variables. I've got a button which has been written using php something like: <? print"<a href="write_review.php?PID=$product_id">img etc...?> and I've got $product_id = $_GET['PID']; at the top of the page! This passes the product ID to the next page so that I can use it! How would I pass another variable too using the same button? I've tried just adding &title=$product_title, but it doesn't seem to work? I've already got $product_title = $_GET['title']; at the top of the page under the first one.
View Replies !
Linking To Page.php?id=variable
I am trying to create an edit/delete user interface similar to the edit/delete section of the mysql database page. each record in the table will have an edit delete beside it. All my attemps so far to link the 'edit' to the corresponding record bring up mypage.php?=(my calculations trying to get the record id, instead of the record id itself) how does one go about creating a dynamic link coorsponding to the record that is needed to be editted? I have the table being created corectly, with edit/delete beside them, but I can't get the link to turn out correctly.
View Replies !
How Can I Pass Variable To Next Page?
I have a search page to search the database, the input from user are include 4 items: keywords country catalog date the results are divided into pages by date desc, so there are PREV10 1 2 3 ... NEXT10 to indicate the page number. Then, How can I pass the 4 items and the page number to next page? I don't wont to use urlencode() and urldecode() because there will be long url in IE's address. I try to set the $HTTP_POST_VARS as cookie, so my code:
View Replies !
Pass Variable To Another Page
i know i can pass a variable with POST or GET. but i want to do the following: a user enters wrong login credentials, so i redirect the user to error.php. but i also want to pass the message "login credentials not found!". I could do this with: header("location:index?php?page=error&err=wrong login credentials"); but i don't want the error string to be visible. can i do this another way? POST doesn't seem an option to me as there isn't a form involved.
View Replies !
Sending A Variable From One Page To Another
I would like to send a variable from one page to another. I have a mysql connect and select statement on page one, it retrieves a variable from the database, how do i send that variable to page two ? the end user does not fill out any forms or press any links, it is just a redirection they come into page one, a variable is grabbed then the variable and end user are to be redirected to page two.
View Replies !
Pass A Variable In The Url To The Next Page
i am trying to pass a variable in the url to the next page: http://www.xxx.com/xxx.php?at=$price then, on the xxx.php page i would just use the following command to retrieve the variable: $test = $_GET['at']; wouldn't this be correct?
View Replies !
Passing A Variable Into A Another Page
I have a list that comes in during a while statement: Jane john pete ..ect and i have a hyperlink so i can view their stats... and i want to past their name so i can get it in the next page...but the variable is not comming up: <a href=info.php?name=$name>".$name."[/url] this is what I get: http://localhost/mdo_main/info.php?name=
View Replies !
Set A Variable From The Previous Page
how am i surpose to set a variable from the previous page check if its same as before if it is then leave the session variable at same value if not change it to $_post['text'] which is the new value to use . Code:
View Replies !
Change Variable In Another Page
i have my form displaying information from my mssql database 1 record. When i click next it goes to php page which from there i want to change the value of a variable in my other php page whihc loads the query for my form then reload my form page with the new record.
View Replies !
Sending Variable To New Page
I am popping up a new window with Javascript and I need to send a PHP variable to that new window. I think this is the way I need to do that. But I get a JS error that $_GET is not defined. win = window.open('MikesFileEditor.php?dir='+$_GET['dir'],'window','height=750, width=700,toolbar=no,directories=no, status=no, menubar=no,scrollbars=no,resizable=no');
View Replies !
|