Re: RE: RE: [PHP] passing variables to php script
On 13 Jan 2012 at 15:05, David Savage dsav...@cytelcom.com wrote: I open the html file up from a windows explorer window (Q:\asterisk\), and so IE opens it up, but the problem lies in the fact that I cannot find apache service running in the background...haven't figured out why yet. The test configuration start menu option (under configure apache server) just displays a console window for a brief moment, then immediately disappears. The icon I see near my time says Running none of 1 Apache servicesSo I have to get that straightened out first...I believe that's been my problem all along. Well, that's going to be part of it, but it's never going to work if you open it via Explorer. If you do that, apache won't be involved whether it's running or not. This will only work if you have IE (or other browser) open and put http://localhost/your-webpage.html into the browser's address bar. Further, both the webpage and PHP file need to be in your document-root. Look in your apache config file for that). -- Cheers -- Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RE: RE: [PHP] passing variables to php script
Make sure IIS is not running. That'll cause all kinds of trouble. Tim Streater wrote: On 13 Jan 2012 at 15:05, David Savage dsav...@cytelcom.com wrote: I open the html file up from a windows explorer window (Q:\asterisk\), and so IE opens it up, but the problem lies in the fact that I cannot find apache service running in the background...haven't figured out why yet. The test configuration start menu option (under configure apache server) just displays a console window for a brief moment, then immediately disappears. The icon I see near my time says Running none of 1 Apache servicesSo I have to get that straightened out first...I believe that's been my problem all along. Well, that's going to be part of it, but it's never going to work if you open it via Explorer. If you do that, apache won't be involved whether it's running or not. This will only work if you have IE (or other browser) open and put http://localhost/your-webpage.html into the browser's address bar. Further, both the webpage and PHP file need to be in your document-root. Look in your apache config file for that). -- Cheers -- Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RE: RE: [PHP] passing variables to php script
Tim Streater wrote: On 13 Jan 2012 at 15:05, David Savage dsav...@cytelcom.com wrote: I open the html file up from a windows explorer window (Q:\asterisk\), and so IE opens it up, but the problem lies in the fact that I cannot find apache service running in the background...haven't figured out why yet. The test configuration start menu option (under configure apache server) just displays a console window for a brief moment, then immediately disappears. The icon I see near my time says Running none of 1 Apache servicesSo I have to get that straightened out first...I believe that's been my problem all along. Well, that's going to be part of it, but it's never going to work if you open it via Explorer. If you do that, apache won't be involved whether it's running or not. This will only work if you have IE (or other browser) open and put http://localhost/your-webpage.html into the browser's address bar. Further, both the webpage and PHP file need to be in your document-root. Look in your apache config file for that). Sorry for the top post. Make sure IIS is not running. It'll cause all kinds of trouble.
RE: RE: RE: [PHP] passing variables to php script
thanks for your assistance. From: Tim Streater [mailto:t...@clothears.org.uk] Sent: Fri 1/13/2012 9:37 AM To: David Savage Cc: PHP General List Subject: Re: RE: RE: [PHP] passing variables to php script On 13 Jan 2012 at 15:05, David Savage dsav...@cytelcom.com wrote: I open the html file up from a windows explorer window (Q:\asterisk\), and so IE opens it up, but the problem lies in the fact that I cannot find apache service running in the background...haven't figured out why yet. The test configuration start menu option (under configure apache server) just displays a console window for a brief moment, then immediately disappears. The icon I see near my time says Running none of 1 Apache servicesSo I have to get that straightened out first...I believe that's been my problem all along. Well, that's going to be part of it, but it's never going to work if you open it via Explorer. If you do that, apache won't be involved whether it's running or not. This will only work if you have IE (or other browser) open and put http://localhost/your-webpage.html into the browser's address bar. Further, both the webpage and PHP file need to be in your document-root. Look in your apache config file for that). -- Cheers -- Tim
RE: [PHP] passing variables to php script
Installed apache onto a win2K server, and have the html file php file in the same folder (Q:\ASTERISK\) on the Q: drive (which is just another drive in this same server). I opened the html file using IE 6.0. What I'm thinking is there may be an issue with some setting on the web server. The php statements I posted were the first few statements in the script, so apparently the script didn't see the variables, so I'll have to review the httpd.conf and php.ini files to find whatever settings is preventing the acctnum, year, and month from being passed to the php script. Thanks to all of you who posted comments for this problem ! I believe it will eventually come together. David From: Ellis Antaya [mailto:ellis.ant...@gmail.com] Sent: Tue 1/10/2012 4:46 PM To: Marco Behnke Cc: php-general@lists.php.net Subject: Re: [PHP] passing variables to php script it can't work as long as long as there is Q:\ ins his form action +1 David, which web server are you running (apache, iis, ...)? What is your document_root? And last question, where are your html file and your php file(the full file path)? --- Ellis (Sent from my iPod) On 2012-01-10, at 16:25, Marco Behnke ma...@behnke.biz wrote: Am 10.01.12 21:57, schrieb Ashley Sheridan: o simply callrecs.php and see if that works. Q: would be referencing a filesystem path, rather a web address interpreted by a PHP processor. Make sure your .php target is within a PHP supported web space. If a default application is set within windows for php, the script submitting to Q will be executed. But wouldn't Windows attempt to execute the PHP script as if it were a CLI script, not as if it were within a web server context? That would make posting a form pretty pointless. Indeed. But isn't that the point? We are trying to figure out why his posting the form does not work. I say, it can't work as long as long as there is Q:\ ins his form action, no way it will do, because you leave your webserver context anyways. He must change it to a valid web url. -- Marco Behnke Dipl. Informatiker (FH), SAE Audio Engineer Diploma Zend Certified Engineer PHP 5.3 Tel.: 0174 / 9722336 e-Mail: ma...@behnke.biz Softwaretechnik Behnke Heinrich-Heine-Str. 7D 21218 Seevetal http://www.behnke.biz http://www.behnke.biz/
Re: [PHP] passing variables to php script
On Thu, Jan 12, 2012 at 7:51 PM, David Savage dsav...@cytelcom.com wrote: Installed apache onto a win2K server, and have the html file php file in the same folder (Q:\ASTERISK\) on the Q: drive (which is just another drive in this same server). I opened the html file using IE 6.0. What I'm thinking is there may be an issue with some setting on the web server. The php statements I posted were the first few statements in the script, so apparently the script didn't see the variables, so I'll have to review the httpd.conf and php.ini files to find whatever settings is preventing the acctnum, year, and month from being passed to the php script. No, Don't open the html file from the drive! If you have installed apache, you can open IE and go to http://localhost, this will show your web site running. If you put the files from Q:\ASTERISK in the folder where the website is, or you set this correctly in httpd.conf then it will show up fine. Now, if you update the form, and replace Q:\ASTERISK\callrecs.php with /callrecs.php, then it'll probably work fine. Matijn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RE: [PHP] passing variables to php script
On 12 Jan 2012 at 18:51, David Savage dsav...@cytelcom.com wrote: Installed apache onto a win2K server, and have the html file php file in the same folder (Q:\ASTERISK\) on the Q: drive (which is just another drive in this same server). I opened the html file using IE 6.0. What I'm thinking is there may be an issue with some setting on the web server. The php statements I posted were the first few statements in the script, so apparently the script didn't see the variables, so I'll have to review the httpd.conf and php.ini files to find whatever settings is preventing the acctnum, year, and month from being passed to the php script. You say: I opened the html file using IE 6.0 I don't like the sound of that. Do you mean you double-clicked the file and it opened in IE or do you mean you put Q:\... into the IE address bar or what? What you should be doing is putting http://localhost/your-file.html in the IE address bar. What is your document-root? Is the Q:\thingy part of it? -- Cheers -- Tim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing variables to php script
David Savage wrote: OK...I admit I'm new at thisI have this html file: html head titleGenerate pdf file of LD, Toll Free, and Directory Assistance calls/titl /head body form action=Q:\ASTERISK\callrecs.php method=post pAccount Number:input type=text name=acctnum/p pYear (4 digit):input type=text name=billyear/p pMonth (2 digit):input type=text name=billmonth/p pinput type=submit //p /form /body /html to which I would input an account number, 4 digit year, then 2 digit month. Then click Submit. What I see in the error log is: [06-Jan-2012 11:42:21] PHP Notice: Undefined index: acctnum [06-Jan-2012 11:42:21] PHP Notice: Undefined index: billyear [06-Jan-2012 11:42:21] PHP Notice: Undefined index: billmonth where line numbers point othe the following php lines: $who=$_POST[acctnum]; $year_to_process=$_POST[billyear]; ; $month_to_process= $_POST[billmonth]; WHAT AM I DOING WRONG ? David I think the error indicates that there is no acctnum,etc. set in your POST array.. but your syntax looks O.K... so, assuming the php code is in callrecs.php, I'm guessing you either have a redirect in there, or are not hitting the callrecs.php with the form data. I'd suggest to post your callrecs.php file. Donovan -- D Brooke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing variables to php script
Am 10.01.12 21:07, schrieb Donovan Brooke: David Savage wrote: OK...I admit I'm new at thisI have this html file: html head titleGenerate pdf file of LD, Toll Free, and Directory Assistance calls/titl /head body form action=Q:\ASTERISK\callrecs.php method=post Stupid question . where have you copied your script? Is it lying on a webserver? Then I would guess that you are submitting the form on your webserver which hits the PHP script on your Desktop PC which in tunr invokes the PHP command line interpreter who has no idea what you mean by $_POST. Try changing the form action to simply callrecs.php and see if that works. -- Marco Behnke Dipl. Informatiker (FH), SAE Audio Engineer Diploma Zend Certified Engineer PHP 5.3 Tel.: 0174 / 9722336 e-Mail: ma...@behnke.biz Softwaretechnik Behnke Heinrich-Heine-Str. 7D 21218 Seevetal http://www.behnke.biz smime.p7s Description: S/MIME Kryptografische Unterschrift
Re: [PHP] passing variables to php script
On Jan 10, 2012, at 15:12, Marco Behnke ma...@behnke.biz wrote: Am 10.01.12 21:07, schrieb Donovan Brooke: David Savage wrote: OK...I admit I'm new at thisI have this html file: html head titleGenerate pdf file of LD, Toll Free, and Directory Assistance calls/titl /head body form action=Q:\ASTERISK\callrecs.php method=post Stupid question . where have you copied your script? Is it lying on a webserver? Then I would guess that you are submitting the form on your webserver which hits the PHP script on your Desktop PC which in tunr invokes the PHP command line interpreter who has no idea what you mean by $_POST. Try changing the form action to simply callrecs.php and see if that works. -- Marco Behnke Dipl. Informatiker (FH), SAE Audio Engineer Diploma Zend Certified Engineer PHP 5.3 Tel.: 0174 / 9722336 e-Mail: ma...@behnke.biz Softwaretechnik Behnke Heinrich-Heine-Str. 7D 21218 Seevetal http://www.behnke.biz Q: would be referencing a filesystem path, rather a web address interpreted by a PHP processor. Make sure your .php target is within a PHP supported web space. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing variables to php script
Am 10.01.12 21:28, schrieb Mike Mackintosh: On Jan 10, 2012, at 15:12, Marco Behnke ma...@behnke.biz wrote: Am 10.01.12 21:07, schrieb Donovan Brooke: David Savage wrote: OK...I admit I'm new at thisI have this html file: html head titleGenerate pdf file of LD, Toll Free, and Directory Assistance calls/titl /head body form action=Q:\ASTERISK\callrecs.php method=post Stupid question . where have you copied your script? Is it lying on a webserver? Then I would guess that you are submitting the form on your webserver which hits the PHP script on your Desktop PC which in tunr invokes the PHP command line interpreter who has no idea what you mean by $_POST. Try changing the form action to simply callrecs.php and see if that works. Q: would be referencing a filesystem path, rather a web address interpreted by a PHP processor. Make sure your .php target is within a PHP supported web space. If a default application is set within windows for php, the script submitting to Q will be executed. -- Marco Behnke Dipl. Informatiker (FH), SAE Audio Engineer Diploma Zend Certified Engineer PHP 5.3 Tel.: 0174 / 9722336 e-Mail: ma...@behnke.biz Softwaretechnik Behnke Heinrich-Heine-Str. 7D 21218 Seevetal http://www.behnke.biz smime.p7s Description: S/MIME Kryptografische Unterschrift
Re: [PHP] passing variables to php script
On Tue, 2012-01-10 at 21:43 +0100, Marco Behnke wrote: Am 10.01.12 21:28, schrieb Mike Mackintosh: On Jan 10, 2012, at 15:12, Marco Behnke ma...@behnke.biz wrote: Am 10.01.12 21:07, schrieb Donovan Brooke: David Savage wrote: OK...I admit I'm new at thisI have this html file: html head titleGenerate pdf file of LD, Toll Free, and Directory Assistance calls/titl /head body form action=Q:\ASTERISK\callrecs.php method=post Stupid question . where have you copied your script? Is it lying on a webserver? Then I would guess that you are submitting the form on your webserver which hits the PHP script on your Desktop PC which in tunr invokes the PHP command line interpreter who has no idea what you mean by $_POST. Try changing the form action to simply callrecs.php and see if that works. Q: would be referencing a filesystem path, rather a web address interpreted by a PHP processor. Make sure your .php target is within a PHP supported web space. If a default application is set within windows for php, the script submitting to Q will be executed. But wouldn't Windows attempt to execute the PHP script as if it were a CLI script, not as if it were within a web server context? That would make posting a form pretty pointless. -- Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] passing variables to php script
On Tue, Jan 10, 2012 at 9:57 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: On Tue, 2012-01-10 at 21:43 +0100, Marco Behnke wrote: Am 10.01.12 21:28, schrieb Mike Mackintosh: On Jan 10, 2012, at 15:12, Marco Behnke ma...@behnke.biz wrote: Am 10.01.12 21:07, schrieb Donovan Brooke: David Savage wrote: OK...I admit I'm new at thisI have this html file: html head titleGenerate pdf file of LD, Toll Free, and Directory Assistance calls/titl /head body form action=Q:\ASTERISK\callrecs.php method=post Stupid question . where have you copied your script? Is it lying on a webserver? Then I would guess that you are submitting the form on your webserver which hits the PHP script on your Desktop PC which in tunr invokes the PHP command line interpreter who has no idea what you mean by $_POST. Try changing the form action to simply callrecs.php and see if that works. Q: would be referencing a filesystem path, rather a web address interpreted by a PHP processor. Make sure your .php target is within a PHP supported web space. If a default application is set within windows for php, the script submitting to Q will be executed. But wouldn't Windows attempt to execute the PHP script as if it were a CLI script, not as if it were within a web server context? That would make posting a form pretty pointless. This all depends on the browser used. IE will probably start it with any program registered to PHP files (most likely an text editor). Firefox and Chrome will probably show the PHP source code in the browser. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing variables to php script
Am 10.01.12 21:57, schrieb Ashley Sheridan: o simply callrecs.php and see if that works. Q: would be referencing a filesystem path, rather a web address interpreted by a PHP processor. Make sure your .php target is within a PHP supported web space. If a default application is set within windows for php, the script submitting to Q will be executed. But wouldn't Windows attempt to execute the PHP script as if it were a CLI script, not as if it were within a web server context? That would make posting a form pretty pointless. Indeed. But isn't that the point? We are trying to figure out why his posting the form does not work. I say, it can't work as long as long as there is Q:\ ins his form action, no way it will do, because you leave your webserver context anyways. He must change it to a valid web url. -- Marco Behnke Dipl. Informatiker (FH), SAE Audio Engineer Diploma Zend Certified Engineer PHP 5.3 Tel.: 0174 / 9722336 e-Mail: ma...@behnke.biz Softwaretechnik Behnke Heinrich-Heine-Str. 7D 21218 Seevetal http://www.behnke.biz smime.p7s Description: S/MIME Kryptografische Unterschrift
Re: [PHP] passing variables to php script
On Tue, 2012-01-10 at 22:25 +0100, Marco Behnke wrote: Am 10.01.12 21:57, schrieb Ashley Sheridan: o simply callrecs.php and see if that works. Q: would be referencing a filesystem path, rather a web address interpreted by a PHP processor. Make sure your .php target is within a PHP supported web space. If a default application is set within windows for php, the script submitting to Q will be executed. But wouldn't Windows attempt to execute the PHP script as if it were a CLI script, not as if it were within a web server context? That would make posting a form pretty pointless. Indeed. But isn't that the point? We are trying to figure out why his posting the form does not work. I say, it can't work as long as long as there is Q:\ ins his form action, no way it will do, because you leave your webserver context anyways. He must change it to a valid web url. -- Marco Behnke Dipl. Informatiker (FH), SAE Audio Engineer Diploma Zend Certified Engineer PHP 5.3 Tel.: 0174 / 9722336 e-Mail: ma...@behnke.biz Softwaretechnik Behnke Heinrich-Heine-Str. 7D 21218 Seevetal http://www.behnke.biz All of which I mentioned last Friday when David first asked the question. -- Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] passing variables to php script
it can't work as long as long as there is Q:\ ins his form action +1 David, which web server are you running (apache, iis, ...)? What is your document_root? And last question, where are your html file and your php file(the full file path)? --- Ellis (Sent from my iPod) On 2012-01-10, at 16:25, Marco Behnke ma...@behnke.biz wrote: Am 10.01.12 21:57, schrieb Ashley Sheridan: o simply callrecs.php and see if that works. Q: would be referencing a filesystem path, rather a web address interpreted by a PHP processor. Make sure your .php target is within a PHP supported web space. If a default application is set within windows for php, the script submitting to Q will be executed. But wouldn't Windows attempt to execute the PHP script as if it were a CLI script, not as if it were within a web server context? That would make posting a form pretty pointless. Indeed. But isn't that the point? We are trying to figure out why his posting the form does not work. I say, it can't work as long as long as there is Q:\ ins his form action, no way it will do, because you leave your webserver context anyways. He must change it to a valid web url. -- Marco Behnke Dipl. Informatiker (FH), SAE Audio Engineer Diploma Zend Certified Engineer PHP 5.3 Tel.: 0174 / 9722336 e-Mail: ma...@behnke.biz Softwaretechnik Behnke Heinrich-Heine-Str. 7D 21218 Seevetal http://www.behnke.biz
[PHP] passing variables to php script
OK...I admit I'm new at thisI have this html file: html head titleGenerate pdf file of LD, Toll Free, and Directory Assistance calls/titl /head body form action=Q:\ASTERISK\callrecs.php method=post pAccount Number: input type=text name=acctnum /p pYear (4 digit): input type=text name=billyear /p pMonth (2 digit): input type=text name=billmonth /p pinput type=submit //p /form /body /html to which I would input an account number, 4 digit year, then 2 digit month. Then click Submit. What I see in the error log is: [06-Jan-2012 11:42:21] PHP Notice: Undefined index: acctnum [06-Jan-2012 11:42:21] PHP Notice: Undefined index: billyear [06-Jan-2012 11:42:21] PHP Notice: Undefined index: billmonth where line numbers point othe the following php lines: $who=$_POST[acctnum]; $year_to_process=$_POST[billyear]; ; $month_to_process= $_POST[billmonth]; WHAT AM I DOING WRONG ? David
Re: [PHP] passing variables to php script
On Fri, 2012-01-06 at 11:53 -0600, David Savage wrote: OK...I admit I'm new at thisI have this html file: html head titleGenerate pdf file of LD, Toll Free, and Directory Assistance calls/titl /head body form action=Q:\ASTERISK\callrecs.php method=post pAccount Number: input type=text name=acctnum /p pYear (4 digit): input type=text name=billyear /p pMonth (2 digit): input type=text name=billmonth /p pinput type=submit //p /form /body /html to which I would input an account number, 4 digit year, then 2 digit month. Then click Submit. What I see in the error log is: [06-Jan-2012 11:42:21] PHP Notice: Undefined index: acctnum [06-Jan-2012 11:42:21] PHP Notice: Undefined index: billyear [06-Jan-2012 11:42:21] PHP Notice: Undefined index: billmonth where line numbers point othe the following php lines: $who=$_POST[acctnum]; $year_to_process=$_POST[billyear]; ; $month_to_process= $_POST[billmonth]; WHAT AM I DOING WRONG ? David PHP must be run on a server, it looks like you're attempting to run it on your local drive without one. Try installing either Xampp or EasyPHP, which will install the Apache server with PHP for you, and then you can run your scripts over http://localhost or http://127.0.0.1 -- Thanks, Ash http://www.ashleysheridan.co.uk
[PHP] Passing Variables to an iframe
This may be more a general HTML question, so let me know if I should post somewhere else. I was hoping to do some logic in a script, and then pass the results of that script to an iframe for more processing. Is it secure to include those variables as get parameters to the iframe, though? In other words, if I have something like this: iframe src=http://example.com/?accesseverything=true; where I use PHP to generate the src for the iframe. Could someone just use Firebug or something to set that variable? Is there a better way of passing it instead? Thanks, Waynn
Re: [PHP] Passing Variables to an iframe
On Fri, Sep 26, 2008 at 7:17 AM, Waynn Lue [EMAIL PROTECTED] wrote: This may be more a general HTML question, so let me know if I should post somewhere else. I was hoping to do some logic in a script, and then pass the results of that script to an iframe for more processing. Is it secure to include those variables as get parameters to the iframe, though? In other words, if I have something like this: iframe src=http://example.com/?accesseverything=true; where I use PHP to generate the src for the iframe. Could someone just use Firebug or something to set that variable? Is there a better way of passing it instead? Thanks, Waynn sessions? -- Bastien Cat, the other other white meat
RE: [PHP] Passing Variables to an iframe
-Original Message- From: Waynn Lue [mailto:[EMAIL PROTECTED] Sent: Friday, September 26, 2008 6:17 AM To: PHP General list Subject: [PHP] Passing Variables to an iframe This may be more a general HTML question, so let me know if I should post somewhere else. I was hoping to do some logic in a script, and then pass the results of that script to an iframe for more processing. Is it secure to include those variables as get parameters to the iframe, though? In other words, if I have something like this: iframe src=http://example.com/?accesseverything=true; where I use PHP to generate the src for the iframe. Could someone just use Firebug or something to set that variable? Is there a better way of passing it instead? I'm still not fully awake yet, so I won't comment as to a better way, but I'll say this: any properties of any DOM element you dish out to the user can be read and/or modified after they have been sent. If you have any filenames, URLs, or sensitive data that is used in processing--but *doesn't* need to be seen by the user or the client machine at any time--don't output it. :) Todd Boyd Web Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Passing Variables to an iframe
Anybody can see it and change it. All user input, which always includes GET/POST/COOKIE data is always untrustworthy. -Original Message- From: Waynn Lue [mailto:[EMAIL PROTECTED] Sent: Friday, September 26, 2008 6:17 AM To: PHP General list Subject: [PHP] Passing Variables to an iframe This may be more a general HTML question, so let me know if I should post somewhere else. I was hoping to do some logic in a script, and then pass the results of that script to an iframe for more processing. Is it secure to include those variables as get parameters to the iframe, though? In other words, if I have something like this: iframe src=http://example.com/?accesseverything=true; where I use PHP to generate the src for the iframe. Could someone just use Firebug or something to set that variable? Is there a better way of passing it instead? Thanks, Waynn ___ The information in this email or in any file attached hereto is intended only for the personal and confiden- tial use of the individual or entity to which it is addressed and may contain information that is propri- etary and confidential. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communica- tion is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product. Email trans- mission cannot be guaranteed to be secure or error- free. P6070214 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing Variables to an iframe
Ah, that makes sense. Given all the input on this thread, I'll see if I can get sessions do what I want. Thanks! Waynn
Re: [PHP] Passing variables between pages
At 11:19 PM +0100 9/21/08, Nathan Rixham wrote: so may as well just have everything in one script then.. You always have the option to write one huge script for any application. But normally in programming, we confront any problem by breaking it down into smaller steps and writing code to solve smaller problems. Whenever any step is finished, then we pass the results on to the next step and continue solving the problem -- is this not correct? I guess it is but as you said your self we break the problem into smaller and easier problems not to seperate files. The old way still works: http://host.net/index.php?mode=jump Meaning that you can separate the file into parts (with or without includes) that solve different part of the problem. So I guess it's done but the question is in what way it is done and whether it is effective. In PHP, we use sessions to pass variables between scripts -- but we could just as well use: ob_clean(); include('next.php'); exit(0); For this will continue the program flow with all the variables intact the same as using sessions -- is this not correct? Well actually by including other files I think that is practically like including all the code of the files in your script. But the a basic difference is that you have two separate files which makes the code easier to read, edit and generally maintain. Maybe I'm not understanding the limitations of this technique -- so, let me put this another way, show me an example where sessions is the answer and my include method won't work. Cheers, tedd I guess every technique has its advantages and disadvantages. It is better for something and bad for something else... -- Thodoris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
At 8:39 PM +0100 9/21/08, Stut wrote: On 21 Sep 2008, at 18:13, Nathan Rixham wrote: at it's simplest is this correct..? index.php ?php $variables = $_POST; include 'anotherscript.php'; ? anotherscript.php ?php print_r( $variables ); //include has access to $variables from parent print_r( $_POST ); //include has access to post data as well ? I'm struggling to follow here I thinks! lol I don't think you're missing the point Nathan, I think you've hit it on the head. This technique does not solve the problem of passing variables between requests. I think the only benefit here is to avoid having to repost data by including the next script rather than bouncing off the browser. Or maybe I'm missing the point. -Stut -Stut and Nathan: The problem was not how to pass variables between requests, but rather how to variables between pages -- as the subject line indicates. There are several options available to do this, I can use POST, GET, COOKIE, and SESSION -- correct? Now, I am only demonstrating there is another option -- try this: script1.php ?php $test = this is a test'; ob_clean(); include('a.php'); exit(0); ? script2.php ?php echo($test); ? Running this successfully passes the variable $test from script1.php to script2.php -- does it not? Here's a working example (showing all code): http://www.webbytedd.com/bb/script2script/ Sure, I am using a form to trigger this operation so you can see it happen, however there is no data contained or passed by the POST -- as shown by the empty print_r($_REQUEST). While this is very simple -- it does pass variables from one script to another without using POST, GET, COOKIE, or SESSION. Or is there something here that I am not getting? Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
At 6:20 PM -0400 9/21/08, Robert Cummings wrote: Looks like a basic front-end loader pattern. Data isn't passed, it's available by virtue of being in the current request's context. Cheers, Rob. Rob: I don't know what a basic front-end loader pattern is, but the data is available to the next script provided that the script is loaded via an include. As I have shown here: http://www.webbytedd.com/bb/script2script/ Here are two separate scripts -- one defines and populates the $test variable and the other echo's the contents proving the pass was made. Also note, there is request to the server made here, but the data (i.e., $test variable ) isn't passed in the normal manner (i.e., POST, GET, SESSION). Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
tedd wrote: -Stut and Nathan: The problem was not how to pass variables between requests, but rather how to variables between pages -- as the subject line indicates. a! now I follow; and surely tedd what you say is indeed the best way of achieving this. cheers for taking the time -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
At 11:19 PM +0100 9/21/08, Nathan Rixham wrote: so may as well just have everything in one script then.. You always have the option to write one huge script for any application. But normally in programming, we confront any problem by breaking it down into smaller steps and writing code to solve smaller problems. Whenever any step is finished, then we pass the results on to the next step and continue solving the problem -- is this not correct? In PHP, we use sessions to pass variables between scripts -- but we could just as well use: ob_clean(); include('next.php'); exit(0); For this will continue the program flow with all the variables intact the same as using sessions -- is this not correct? Maybe I'm not understanding the limitations of this technique -- so, let me put this another way, show me an example where sessions is the answer and my include method won't work. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
At 2:47 PM +0100 9/22/08, Nathan Rixham wrote: tedd wrote: -Stut and Nathan: The problem was not how to pass variables between requests, but rather how to variables between pages -- as the subject line indicates. a! now I follow; and surely tedd what you say is indeed the best way of achieving this. cheers for taking the time Nathan: No problem. But here is what I would like you to consider, the next time you are thinking about using sessions to pass variables to the next script, try this technique instead. You see, a few months ago I was working with another programmer who had a script that contained far more data than what I wanted to break down into sessions to pass to my script. So I tried this and to my surprise it worked flawlessly. Then I thought Where else could I use this? and it seems that I can use this everywhere. Now, I've had three hours of sleep, so my mind may be more fuzzy than usual, but I can't think of an example where I can't use this technique instead of using sessions. If you can think of one, please tell me. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
On Mon, Sep 22, 2008 at 9:49 AM, tedd [EMAIL PROTECTED] wrote: At 11:19 PM +0100 9/21/08, Nathan Rixham wrote: so may as well just have everything in one script then.. You always have the option to write one huge script for any application. But normally in programming, we confront any problem by breaking it down into smaller steps and writing code to solve smaller problems. Whenever any step is finished, then we pass the results on to the next step and continue solving the problem -- is this not correct? In PHP, we use sessions to pass variables between scripts -- but we could just as well use: ob_clean(); include('next.php'); exit(0); For this will continue the program flow with all the variables intact the same as using sessions -- is this not correct? Maybe I'm not understanding the limitations of this technique -- so, let me put this another way, show me an example where sessions is the answer and my include method won't work. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php I don't understand what sort of point you're trying to make with this? The original poster asked how to keep state between different pages which in that context did mean separate requests. It seems like you're trying to be confusing on purpose. In all of my applications there is a clear definition between requests variables, session variables, global configuration variables, and local variables. So just defining $foo saying include 'steptwo.php' to echo $foo really wouldn't make a whole lot of sense to me from your example. Where did $foo come from when steptwo.php runs? Do you always assume steptwo.php is an include and prevent direct access to it? Do you check to see if $foo exists and if not check the query string? Was $foo validated to be the correct data type/length requirements, etc if so? That would be a double check for nothing in some cases. I do use this technique inside of my templating class though. All it does is assign variables to a class and then I access them inside of the template which is just included inside of my render() method. This is a very controlled situation though since I know that the context is output and my input has been validated at this point and all output will be escaped. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
tedd wrote: At 2:47 PM +0100 9/22/08, Nathan Rixham wrote: tedd wrote: -Stut and Nathan: The problem was not how to pass variables between requests, but rather how to variables between pages -- as the subject line indicates. a! now I follow; and surely tedd what you say is indeed the best way of achieving this. cheers for taking the time Nathan: No problem. But here is what I would like you to consider, the next time you are thinking about using sessions to pass variables to the next script, try this technique instead. You see, a few months ago I was working with another programmer who had a script that contained far more data than what I wanted to break down into sessions to pass to my script. So I tried this and to my surprise it worked flawlessly. Then I thought Where else could I use this? and it seems that I can use this everywhere. Now, I've had three hours of sleep, so my mind may be more fuzzy than usual, but I can't think of an example where I can't use this technique instead of using sessions. If you can think of one, please tell me. Cheers, tedd Tedd, I just read this whole multi-threaded thread back again (seems the php lists are multi-threaded even if php is not :p); and here's what I've concluded. 1: how to pass variables between pages that is what the subject line indicates; however the content of the mail taken in context indicates otherwise. Here's some context... I am working on a timecard system where they are presented the main page, where they login they are *brought to a screen where they need to* clock in/out. It all starts working great, but when they clock in/out it loses the variable that says they are logged in so it tries to re-authenticate them which *doesn't work since the username/password are no longer in the $_POST array*... I'm completely passing the blame for all this over to Master Prium for in-correctly titling his posts 2: Passing Variables Between Scripts hate to say this; but I was always under the impression that what you describe was a core/fundamental part of PHP and everybody had been doing it since PHP3. Includes share the same request scope as the requested script; and also has access to all variables/constants defined in it. 99.9% of scripts I've ever seen have done this; even just when using a config.php / database.php or similar.. 3: Passing Variables Between Requests. $_SESSION; fact is HTTP is stateless; the only way to save this info is on the server, which can only be physical disc or physical memory; lot's of different ways of getting there; but you're gonna have to store it on the server somewhere and standard session's are the simplest way until you get into the ol' multiserver sessions thing. Honest Tedd, I've tried this; personally I won't stick anything in session other than the odd identifier - all other bits of data and variables I either store statically in classes or simply do not need to use again due to the way the app's are designed. Jason; stick the data you need in session; a little $_SESSION['is_authed'] = $userid; or such like will suffice to identify until you find you need more security. Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
On 22 Sep 2008, at 15:08, tedd wrote: At 2:47 PM +0100 9/22/08, Nathan Rixham wrote: tedd wrote: -Stut and Nathan: The problem was not how to pass variables between requests, but rather how to variables between pages -- as the subject line indicates. a! now I follow; and surely tedd what you say is indeed the best way of achieving this. cheers for taking the time Nathan: No problem. But here is what I would like you to consider, the next time you are thinking about using sessions to pass variables to the next script, try this technique instead. You see, a few months ago I was working with another programmer who had a script that contained far more data than what I wanted to break down into sessions to pass to my script. So I tried this and to my surprise it worked flawlessly. Then I thought Where else could I use this? and it seems that I can use this everywhere. Now, I've had three hours of sleep, so my mind may be more fuzzy than usual, but I can't think of an example where I can't use this technique instead of using sessions. If you can think of one, please tell me. How about keeping track of a logged in user from request to request without resorting to adding data to the GET parameters, or using a form (ugh!), or a cookie (which is how I'd do it and is how sessions commonly do it). Tedd, the technique you describe is as old as the hills and really only solves a fake problem that arises when you consider each PHP script to be a page and decide that you need to bounce off the browser to pass data from script to script. Once you graduate from that into thinking about each script as a piece of functionality rather than a page it's no big leap from there to including other scripts. Consider this example... a lot of the pages on a site requires a user to be logged in. So at the top of each script that forms a page there is a chunk of code that checks to see if someone is logged in and displays the login form if they're not. Commonly there are two ways to do this, either with an HTTP redirect or by including the script that displays the form. Now consider that you want to pass the current URL to the login form so it can tell the form handler to redirect back here when login has been successful. What are the choices? 1) If doing an HTTP redirect you could add it as a GET variable which the login form script can check for and include in the login form to pass it to the handler. 2) If including the login form it will already have access to that variable so no passing needs to occur. Which is better is a matter of taste, but either way once the user has been logged in you need something to go back and forth with each request to keep track of the fact that someone is logged in. Your technique does not solve this problem in any way I can see. So essentially it comes down to semantics. What is a page? What is a script? What is a request? To me the three are completely different and treating them as such has great architectural and reuse benefits. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
On Sep 22, 2008, at 10:41 AM, Nathan Rixham wrote: tedd wrote: At 2:47 PM +0100 9/22/08, Nathan Rixham wrote: tedd wrote: -Stut and Nathan: The problem was not how to pass variables between requests, but rather how to variables between pages -- as the subject line indicates. a! now I follow; and surely tedd what you say is indeed the best way of achieving this. cheers for taking the time Nathan: No problem. But here is what I would like you to consider, the next time you are thinking about using sessions to pass variables to the next script, try this technique instead. You see, a few months ago I was working with another programmer who had a script that contained far more data than what I wanted to break down into sessions to pass to my script. So I tried this and to my surprise it worked flawlessly. Then I thought Where else could I use this? and it seems that I can use this everywhere. Now, I've had three hours of sleep, so my mind may be more fuzzy than usual, but I can't think of an example where I can't use this technique instead of using sessions. If you can think of one, please tell me. Cheers, tedd Tedd, I just read this whole multi-threaded thread back again (seems the php lists are multi-threaded even if php is not :p); and here's what I've concluded. 1: how to pass variables between pages that is what the subject line indicates; however the content of the mail taken in context indicates otherwise. Here's some context... I am working on a timecard system where they are presented the main page, where they login they are *brought to a screen where they need to* clock in/out. It all starts working great, but when they clock in/out it loses the variable that says they are logged in so it tries to re-authenticate them which *doesn't work since the username/password are no longer in the $_POST array*... I'm completely passing the blame for all this over to Master Prium for in-correctly titling his posts Okay so I could have worded it better and you typoed my name :P Pruim notice the I and the U :) 2: Passing Variables Between Scripts hate to say this; but I was always under the impression that what you describe was a core/fundamental part of PHP and everybody had been doing it since PHP3. Includes share the same request scope as the requested script; and also has access to all variables/constants defined in it. 99.9% of scripts I've ever seen have done this; even just when using a config.php / database.php or similar.. 3: Passing Variables Between Requests. $_SESSION; fact is HTTP is stateless; the only way to save this info is on the server, which can only be physical disc or physical memory; lot's of different ways of getting there; but you're gonna have to store it on the server somewhere and standard session's are the simplest way until you get into the ol' multiserver sessions thing. Honest Tedd, I've tried this; personally I won't stick anything in session other than the odd identifier - all other bits of data and variables I either store statically in classes or simply do not need to use again due to the way the app's are designed. Jason; stick the data you need in session; a little $_SESSION['is_authed'] = $userid; or such like will suffice to identify until you find you need more security. that's what I've started doing, but I have run into some small issues with sessions.. but I'm not ready to ask a question about it yet :) Want to play with it my self first. -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
I would think debugging a chain of code is more of a nightmare than debugging a $_SESSION variable. Also, HTTP is a stateless protocol no matter what you do. If you want to pass data around, the only ways to do it are $_SESSIONS and cookies with $_SESSIONS being preferable as they stay on the server. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com tedd wrote: However, there is another way, but it takes a little forethought. The technique is simply to continue the flow of a single script by using includes. Here's an example: http://www.webbytedd.com/bb/tedd/index.php The code behind this is very simple. You simply branch to other scripts by doing this: ob_clean; include('the-next-script.php); exit(); This keeps ALL the variables intact because it acts like one large script. -- it's not stateless and this technique works. However, what I don't understand is why it isn't used more often? Unless there is something here I don't understand, I believe I could use this technique to write all the scripts I currently use without ever using a session variable. Cheers, tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
You're not passing anything from the browser which is what the OP wanted. You're hard coding variables and the using them in other scripts. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com tedd wrote: I don't know what a basic front-end loader pattern is, but the data is available to the next script provided that the script is loaded via an include. As I have shown here: http://www.webbytedd.com/bb/script2script/ Here are two separate scripts -- one defines and populates the $test variable and the other echo's the contents proving the pass was made. Also note, there is request to the server made here, but the data (i.e., $test variable ) isn't passed in the normal manner (i.e., POST, GET, SESSION). Cheers, tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
Sessions are used to pass dynamic content between pages. Your method is passing static content. Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com tedd wrote: No problem. But here is what I would like you to consider, the next time you are thinking about using sessions to pass variables to the next script, try this technique instead. You see, a few months ago I was working with another programmer who had a script that contained far more data than what I wanted to break down into sessions to pass to my script. So I tried this and to my surprise it worked flawlessly. Then I thought Where else could I use this? and it seems that I can use this everywhere. Now, I've had three hours of sleep, so my mind may be more fuzzy than usual, but I can't think of an example where I can't use this technique instead of using sessions. If you can think of one, please tell me. Cheers, tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
At 10:18 AM -0400 9/22/08, Eric Butera wrote: I don't understand what sort of point you're trying to make with this? The original poster asked how to keep state between different pages which in that context did mean separate requests. It seems like you're trying to be confusing on purpose. No, I'm not trying to be confusing on purpose. I had a point to make, but failed at making it. I'll shut up -- sorry for the noise. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
tedd wrote: At 8:31 PM +0100 9/20/08, Nathan Rixham wrote: Am I missing something here..? Yes. You are missing the point. This is exactly the same; you don't need $_SESSION's in this case because all you're doing is POST'ing the data every time.. And that's what you are missing -- it's not continued POSTing! Follow closely, http://www.webbytedd.com/bb/php-run-php/ While I'm using a Submit Post button to go from this script to the next script I am NOT sending any data via the POST. To prove it, use FF and see what's passed. All data is passed/available to the next script because the next script is an include. For example, this parent script has the variable: $test = This is a test; And the next script (either a.php, or b.php, or c.php -- your choice) simply echo's $test. Please note, the contents of the variable $test was NOT passed via a POST, but rather retained because the parent script included the next script. Do you see the difference? Here's another example presenting the same technique in a different way: http://www.webbytedd.com/bb/tedd/index.php All the variables remain intact AND there is nothing in the REQUEST, SESSION nor COOKIE arrays. I have a hard time trying to get people to understand this simple concept. It's so simple that people often overlook how powerful it is. For example, with a little forethought, I think there isn't a script I've written that I could not have used this technique and dispensed with SESSION's all together. That's pretty powerful, don't you think? Do you understand what I'm doing now? no ill-intention meant. That's Okay -- I realize you meant no ill-intent. Neither do I -- I realize that occasionally simple concepts are hard for you smarter guys to get because you have to dumb down a lot to consider what we're talking about. But I think it's an interesting concept to consider. Cheers, tedd at it's simplest is this correct..? index.php ?php $variables = $_POST; include 'anotherscript.php'; ? anotherscript.php ?php print_r( $variables ); //include has access to $variables from parent print_r( $_POST ); //include has access to post data as well ? I'm struggling to follow here I thinks! lol -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
On 21 Sep 2008, at 18:13, Nathan Rixham wrote: tedd wrote: At 8:31 PM +0100 9/20/08, Nathan Rixham wrote: Am I missing something here..? Yes. You are missing the point. This is exactly the same; you don't need $_SESSION's in this case because all you're doing is POST'ing the data every time.. And that's what you are missing -- it's not continued POSTing! Follow closely, http://www.webbytedd.com/bb/php-run-php/ While I'm using a Submit Post button to go from this script to the next script I am NOT sending any data via the POST. To prove it, use FF and see what's passed. All data is passed/available to the next script because the next script is an include. For example, this parent script has the variable: $test = This is a test; And the next script (either a.php, or b.php, or c.php -- your choice) simply echo's $test. Please note, the contents of the variable $test was NOT passed via a POST, but rather retained because the parent script included the next script. Do you see the difference? Here's another example presenting the same technique in a different way: http://www.webbytedd.com/bb/tedd/index.php All the variables remain intact AND there is nothing in the REQUEST, SESSION nor COOKIE arrays. I have a hard time trying to get people to understand this simple concept. It's so simple that people often overlook how powerful it is. For example, with a little forethought, I think there isn't a script I've written that I could not have used this technique and dispensed with SESSION's all together. That's pretty powerful, don't you think? Do you understand what I'm doing now? no ill-intention meant. That's Okay -- I realize you meant no ill-intent. Neither do I -- I realize that occasionally simple concepts are hard for you smarter guys to get because you have to dumb down a lot to consider what we're talking about. But I think it's an interesting concept to consider. Cheers, tedd at it's simplest is this correct..? index.php ?php $variables = $_POST; include 'anotherscript.php'; ? anotherscript.php ?php print_r( $variables ); //include has access to $variables from parent print_r( $_POST ); //include has access to post data as well ? I'm struggling to follow here I thinks! lol I don't think you're missing the point Nathan, I think you've hit it on the head. This technique does not solve the problem of passing variables between requests. I think the only benefit here is to avoid having to repost data by including the next script rather than bouncing off the browser. Or maybe I'm missing the point. -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
On Sun, 2008-09-21 at 20:39 +0100, Stut wrote: On 21 Sep 2008, at 18:13, Nathan Rixham wrote: tedd wrote: At 8:31 PM +0100 9/20/08, Nathan Rixham wrote: Am I missing something here..? Yes. You are missing the point. This is exactly the same; you don't need $_SESSION's in this case because all you're doing is POST'ing the data every time.. And that's what you are missing -- it's not continued POSTing! Follow closely, http://www.webbytedd.com/bb/php-run-php/ While I'm using a Submit Post button to go from this script to the next script I am NOT sending any data via the POST. To prove it, use FF and see what's passed. All data is passed/available to the next script because the next script is an include. For example, this parent script has the variable: $test = This is a test; And the next script (either a.php, or b.php, or c.php -- your choice) simply echo's $test. Please note, the contents of the variable $test was NOT passed via a POST, but rather retained because the parent script included the next script. Do you see the difference? Here's another example presenting the same technique in a different way: http://www.webbytedd.com/bb/tedd/index.php All the variables remain intact AND there is nothing in the REQUEST, SESSION nor COOKIE arrays. I have a hard time trying to get people to understand this simple concept. It's so simple that people often overlook how powerful it is. For example, with a little forethought, I think there isn't a script I've written that I could not have used this technique and dispensed with SESSION's all together. That's pretty powerful, don't you think? Do you understand what I'm doing now? no ill-intention meant. That's Okay -- I realize you meant no ill-intent. Neither do I -- I realize that occasionally simple concepts are hard for you smarter guys to get because you have to dumb down a lot to consider what we're talking about. But I think it's an interesting concept to consider. Cheers, tedd at it's simplest is this correct..? index.php ?php $variables = $_POST; include 'anotherscript.php'; ? anotherscript.php ?php print_r( $variables ); //include has access to $variables from parent print_r( $_POST ); //include has access to post data as well ? I'm struggling to follow here I thinks! lol I don't think you're missing the point Nathan, I think you've hit it on the head. This technique does not solve the problem of passing variables between requests. I think the only benefit here is to avoid having to repost data by including the next script rather than bouncing off the browser. Or maybe I'm missing the point. Looks like a basic front-end loader pattern. Data isn't passed, it's available by virtue of being in the current request's context. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
Robert Cummings wrote: On Sun, 2008-09-21 at 20:39 +0100, Stut wrote: On 21 Sep 2008, at 18:13, Nathan Rixham wrote: tedd wrote: At 8:31 PM +0100 9/20/08, Nathan Rixham wrote: Am I missing something here..? Yes. You are missing the point. This is exactly the same; you don't need $_SESSION's in this case because all you're doing is POST'ing the data every time.. And that's what you are missing -- it's not continued POSTing! Follow closely, http://www.webbytedd.com/bb/php-run-php/ While I'm using a Submit Post button to go from this script to the next script I am NOT sending any data via the POST. To prove it, use FF and see what's passed. All data is passed/available to the next script because the next script is an include. For example, this parent script has the variable: $test = This is a test; And the next script (either a.php, or b.php, or c.php -- your choice) simply echo's $test. Please note, the contents of the variable $test was NOT passed via a POST, but rather retained because the parent script included the next script. Do you see the difference? Here's another example presenting the same technique in a different way: http://www.webbytedd.com/bb/tedd/index.php All the variables remain intact AND there is nothing in the REQUEST, SESSION nor COOKIE arrays. I have a hard time trying to get people to understand this simple concept. It's so simple that people often overlook how powerful it is. For example, with a little forethought, I think there isn't a script I've written that I could not have used this technique and dispensed with SESSION's all together. That's pretty powerful, don't you think? Do you understand what I'm doing now? no ill-intention meant. That's Okay -- I realize you meant no ill-intent. Neither do I -- I realize that occasionally simple concepts are hard for you smarter guys to get because you have to dumb down a lot to consider what we're talking about. But I think it's an interesting concept to consider. Cheers, tedd at it's simplest is this correct..? index.php ?php $variables = $_POST; include 'anotherscript.php'; ? anotherscript.php ?php print_r( $variables ); //include has access to $variables from parent print_r( $_POST ); //include has access to post data as well ? I'm struggling to follow here I thinks! lol I don't think you're missing the point Nathan, I think you've hit it on the head. This technique does not solve the problem of passing variables between requests. I think the only benefit here is to avoid having to repost data by including the next script rather than bouncing off the browser. Or maybe I'm missing the point. Looks like a basic front-end loader pattern. Data isn't passed, it's available by virtue of being in the current request's context. Cheers, Rob. so may as well just have everything in one script then.. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
tedd wrote: At 12:42 PM -0400 9/19/08, Dan Joseph wrote: On Fri, Sep 19, 2008 at 12:35 PM, tedd [EMAIL PROTECTED] wrote: At 12:22 PM -0400 9/19/08, Jason Pruim wrote: It's interesting that another topic (i.e. [PHP] SESSIONS vs. MySQL) is discussing the differences in storing variables in SESSIONS as compared to storing them in MySQL when using this technique would not require either. You've definitely raised an interesting topic. Question though... a system requires different levels of access to see various parts of the system. How does your method of doing things w/o sessions accomidate that? Does it use that information from the origin POST? Also, is this secure? Any loop holes? I don't see any loop holes and it's secure as any other php script. The technique holds all variables intact, including POST, GET, SESSION, et all arrays. This does work -- as shown by this: http://www.webbytedd.com/bb/tedd/index.php Here's another example: http://www.webbytedd.com/bb/php-run-php/ Note that $test is defined and populated with This is a test at the start of the parent script -- however, the contents of the variable remain regardless of which script you choose. Cheers, tedd sorry to wade in on this one but it seem's like a bit of false logic to me; and isn't actually doing anything different than standard php functionality. (includes always have access to get/post/session/server and variables defined before the script was included) For years people have simply ran a whole website through a single index.php and called the modules via include (the whole ?mod=contact era) This is exactly the same; you don't need $_SESSION's in this case because all you're doing is POST'ing the data every time.. from the source of you're demo: input type='hidden' name='var2' value='This is another string here' p input type=submit value='Click to Continue' /p Thus all we are talking about is replacing session with multiple posts to carry the data; which is a nightmare; shows up awful messages if a user clicks back in IE and asks the user to resend data in firefox where obviously they'll be like er what data did I send :o Am I missing something here..? Regards and no ill-intention meant. Nathan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
At 8:31 PM +0100 9/20/08, Nathan Rixham wrote: Am I missing something here..? Yes. You are missing the point. This is exactly the same; you don't need $_SESSION's in this case because all you're doing is POST'ing the data every time.. And that's what you are missing -- it's not continued POSTing! Follow closely, http://www.webbytedd.com/bb/php-run-php/ While I'm using a Submit Post button to go from this script to the next script I am NOT sending any data via the POST. To prove it, use FF and see what's passed. All data is passed/available to the next script because the next script is an include. For example, this parent script has the variable: $test = This is a test; And the next script (either a.php, or b.php, or c.php -- your choice) simply echo's $test. Please note, the contents of the variable $test was NOT passed via a POST, but rather retained because the parent script included the next script. Do you see the difference? Here's another example presenting the same technique in a different way: http://www.webbytedd.com/bb/tedd/index.php All the variables remain intact AND there is nothing in the REQUEST, SESSION nor COOKIE arrays. I have a hard time trying to get people to understand this simple concept. It's so simple that people often overlook how powerful it is. For example, with a little forethought, I think there isn't a script I've written that I could not have used this technique and dispensed with SESSION's all together. That's pretty powerful, don't you think? Do you understand what I'm doing now? no ill-intention meant. That's Okay -- I realize you meant no ill-intent. Neither do I -- I realize that occasionally simple concepts are hard for you smarter guys to get because you have to dumb down a lot to consider what we're talking about. But I think it's an interesting concept to consider. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing variables between pages
Hi everyone, Stupid question of the week... A array variable is not being passed between 2 pages. Are my options: #1. Use sessions? #2. Use cookies? #3. Use a hidden form to pass the variable's around? Here's some context... I am working on a timecard system where they are presented the main page, where they login they are brought to a screen where they need to clock in/out. It all starts working great, but when they clock in/out it loses the variable that says they are logged in so it tries to re-authenticate them which doesn't work since the username/password are no longer in the $_POST array... I can provide code if needed, but I think it's just a logic problem on my end :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
On Fri, Sep 19, 2008 at 10:54 AM, Jason Pruim [EMAIL PROTECTED] wrote: Hi everyone, Stupid question of the week... A array variable is not being passed between 2 pages. Are my options: #1. Use sessions? #2. Use cookies? #3. Use a hidden form to pass the variable's around? Here's some context... I am working on a timecard system where they are presented the main page, where they login they are brought to a screen where they need to clock in/out. It all starts working great, but when they clock in/out it loses the variable that says they are logged in so it tries to re-authenticate them which doesn't work since the username/password are no longer in the $_POST array... I can provide code if needed, but I think it's just a logic problem on my end :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php If I am understanding correctly... It sounds like you need to pass that variable in your $_SESSION's. You'll want to carry that $_SESSION you established upon login over to the page that handles clicking in and out. From what I gather here, this is what I'd do. Main page, login, $_SESSION gets set. Click on check in, page to check in comes up, does a session_start(), and then you check for that $_SESSION variable to make sure its still them. Check on each page for that session var, if its gone, put 'em back to the log in page. Make sense? -- -Dan Joseph www.canishosting.com - Plans start @ $1.99/month. Build a man a fire, and he will be warm for the rest of the day. Light a man on fire, and will be warm for the rest of his life.
Re: [PHP] Passing variables between pages
On Sep 19, 2008, at 11:08 AM, Dan Joseph wrote: On Fri, Sep 19, 2008 at 10:54 AM, Jason Pruim [EMAIL PROTECTED] wrote: Hi everyone, Stupid question of the week... A array variable is not being passed between 2 pages. Are my options: #1. Use sessions? #2. Use cookies? #3. Use a hidden form to pass the variable's around? Here's some context... I am working on a timecard system where they are presented the main page, where they login they are brought to a screen where they need to clock in/out. It all starts working great, but when they clock in/out it loses the variable that says they are logged in so it tries to re-authenticate them which doesn't work since the username/password are no longer in the $_POST array... I can provide code if needed, but I think it's just a logic problem on my end :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php If I am understanding correctly... It sounds like you need to pass that variable in your $_SESSION's. You'll want to carry that $_SESSION you established upon login over to the page that handles clicking in and out. From what I gather here, this is what I'd do. Main page, login, $_SESSION gets set. Click on check in, page to check in comes up, does a session_start(), and then you check for that $_SESSION variable to make sure its still them. Check on each page for that session var, if its gone, put 'em back to the log in page. Make sense? It makes perfect sense... Was just trying to avoid sessions since this application will be limited to about 10 people and restricted to the company intranet :) But I may just go down the session's route since I know how to work with those quite well... Thanks for the info! -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
!-- SNIP -- Main page, login, $_SESSION gets set. !-- SNIP -- What Dan says, Sessions is the way to go with anything where you have logins and need to do more stuff with the person. Easy to set up, easy to handle... Of course, if you want to do it without sessions, you could get the session ID when they login to the server, store it in a DB table that they are logged in, then if the session ID goes away, then you log them out and push them to the login page. But why go around your elbow to blow your nose? Wolf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
Jason Pruim wrote: Hi everyone, Stupid question of the week... A array variable is not being passed between 2 pages. Are my options: #1. Use sessions? #2. Use cookies? #3. Use a hidden form to pass the variable's around? Here's some context... I am working on a timecard system where they are presented the main page, where they login they are brought to a screen where they need to clock in/out. It all starts working great, but when they clock in/out it loses the variable that says they are logged in so it tries to re-authenticate them which doesn't work since the username/password are no longer in the $_POST array... I can provide code if needed, but I think it's just a logic problem on my end :) -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com [EMAIL PROTECTED] Well actually these are the *obvious* options but by far not the only. These two for e.g. are extra options you have: http://www.php.net/manual/en/intro.msession.php http://www.php.net/manual/en/intro.memcache.php -- Thodoris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
At 11:15 AM -0400 9/19/08, Jason Pruim wrote: It makes perfect sense... Was just trying to avoid sessions since this application will be limited to about 10 people and restricted to the company intranet :) But the script is still stateless regardless of the number of people or if it's limited to the company's intranet. In either event, when the user moves from one page to another page, all the variables are lost. So, you need to use sessions or cookies. However, there is another way, but it takes a little forethought. The technique is simply to continue the flow of a single script by using includes. Here's an example: http://www.webbytedd.com/bb/tedd/index.php The code behind this is very simple. You simply branch to other scripts by doing this: ob_clean; include('the-next-script.php); exit(); This keeps ALL the variables intact because it acts like one large script. -- it's not stateless and this technique works. However, what I don't understand is why it isn't used more often? Unless there is something here I don't understand, I believe I could use this technique to write all the scripts I currently use without ever using a session variable. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
At 11:20 AM -0400 9/19/08, Wolf wrote: But why go around your elbow to blow your nose? Wolf Yeah, That's like pounding sand in a gopher hole -- a phrase (one of many) that my wife uses that I have yet to understand. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
On Sep 19, 2008, at 12:11 PM, tedd wrote: At 11:15 AM -0400 9/19/08, Jason Pruim wrote: It makes perfect sense... Was just trying to avoid sessions since this application will be limited to about 10 people and restricted to the company intranet :) But the script is still stateless regardless of the number of people or if it's limited to the company's intranet. In either event, when the user moves from one page to another page, all the variables are lost. So, you need to use sessions or cookies. However, there is another way, but it takes a little forethought. The technique is simply to continue the flow of a single script by using includes. Here's an example: http://www.webbytedd.com/bb/tedd/index.php The code behind this is very simple. You simply branch to other scripts by doing this: ob_clean; include('the-next-script.php); exit(); This keeps ALL the variables intact because it acts like one large script. -- it's not stateless and this technique works. However, what I don't understand is why it isn't used more often? Unless there is something here I don't understand, I believe I could use this technique to write all the scripts I currently use without ever using a session variable. So if I'm understanding you right... You're suggesting that in my timecard app which has index.php (user login) and timecard.php (Actual time card app) I could simply load index.php and then on submit have it do this: ob_clean; include(timecard.php); exit(); Putting that in a function, or a separate file... And then I have my variable intact and I still get to the second page without having to use sessions? Very interesting... This is something that I will have to play with more later... -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 11287 James St Holland, MI 49424 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
At 12:22 PM -0400 9/19/08, Jason Pruim wrote: So if I'm understanding you right... You're suggesting that in my timecard app which has index.php (user login) and timecard.php (Actual time card app) I could simply load index.php and then on submit have it do this: ob_clean; include(timecard.php); exit(); Putting that in a function, or a separate file... And then I have my variable intact and I still get to the second page without having to use sessions? Very interesting... This is something that I will have to play with more later... Yes, that's exactly right. You can go from script, to script, to script without ever using sessions -- everything remains in memory as if it's one large script. Of course, you still have to respect the scope of variables, such as being required to provide them to functions -- but all variables and arrays (even POST, GET and SESSION) will still have all their contents intact. It's interesting that another topic (i.e. [PHP] SESSIONS vs. MySQL) is discussing the differences in storing variables in SESSIONS as compared to storing them in MySQL when using this technique would not require either. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables between pages
On Fri, Sep 19, 2008 at 12:35 PM, tedd [EMAIL PROTECTED] wrote: At 12:22 PM -0400 9/19/08, Jason Pruim wrote: It's interesting that another topic (i.e. [PHP] SESSIONS vs. MySQL) is discussing the differences in storing variables in SESSIONS as compared to storing them in MySQL when using this technique would not require either. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You've definitely raised an interesting topic. Question though... a system requires different levels of access to see various parts of the system. How does your method of doing things w/o sessions accomidate that? Does it use that information from the origin POST? Also, is this secure? Any loop holes? -- -Dan Joseph www.canishosting.com - Plans start @ $1.99/month. Build a man a fire, and he will be warm for the rest of the day. Light a man on fire, and will be warm for the rest of his life.
Re: [PHP] Passing variables between pages
At 12:42 PM -0400 9/19/08, Dan Joseph wrote: On Fri, Sep 19, 2008 at 12:35 PM, tedd [EMAIL PROTECTED] wrote: At 12:22 PM -0400 9/19/08, Jason Pruim wrote: It's interesting that another topic (i.e. [PHP] SESSIONS vs. MySQL) is discussing the differences in storing variables in SESSIONS as compared to storing them in MySQL when using this technique would not require either. You've definitely raised an interesting topic. Question though... a system requires different levels of access to see various parts of the system. How does your method of doing things w/o sessions accomidate that? Does it use that information from the origin POST? Also, is this secure? Any loop holes? I don't see any loop holes and it's secure as any other php script. The technique holds all variables intact, including POST, GET, SESSION, et all arrays. This does work -- as shown by this: http://www.webbytedd.com/bb/tedd/index.php Here's another example: http://www.webbytedd.com/bb/php-run-php/ Note that $test is defined and populated with This is a test at the start of the parent script -- however, the contents of the variable remain regardless of which script you choose. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] passing variables values using POST
i am presently passing the value of a variable to a php file using GET after data has been inserted to the database. ex= $firstname = $_POST[firstname]; if(!$sqlconnection) { echo error message; } else { header(Location: thankyou.php?firstnameis=$firstname); } how can i send the value of $firstname using POST instead of GET as the value is presently appearing in the address bar. ideally i would like using POST. NOTE = please suggest techniques that does NOT involve javascript in order to pass $firstname using POST method, as i have done the entire validations using php and i have assumed that user has javascript turned off. please advice. thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing variables values using POST
On 18 Mar 2008, at 10:43, Sudhakar wrote: i am presently passing the value of a variable to a php file using GET after data has been inserted to the database. ex= $firstname = $_POST[firstname]; if(!$sqlconnection) { echo error message; } else { header(Location: thankyou.php?firstnameis=$firstname); } how can i send the value of $firstname using POST instead of GET as the value is presently appearing in the address bar. ideally i would like using POST. NOTE = please suggest techniques that does NOT involve javascript in order to pass $firstname using POST method, as i have done the entire validations using php and i have assumed that user has javascript turned off. In that case it can't be done. You cannot trigger a post on the client- side without using Javascript. Why do you need to redirect? Why can't you display the thankyou.php page inline rather than bouncing off the client? -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing variables values using POST
On Tue, Mar 18, 2008 at 12:45 PM, Stut [EMAIL PROTECTED] wrote: On 18 Mar 2008, at 10:43, Sudhakar wrote: i am presently passing the value of a variable to a php file using GET after data has been inserted to the database. Why do you need to redirect? Why can't you display the thankyou.php page inline rather than bouncing off the client? or you can register the firstname into a session variable and use it on the landing page. but what stut suggests is the best. ~viraj -Stut -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing variables values using POST
On Mar 18, 2008, at 6:43 AM, Sudhakar wrote: i am presently passing the value of a variable to a php file using GET after data has been inserted to the database. ex= $firstname = $_POST[firstname]; if(!$sqlconnection) { echo error message; } else { header(Location: thankyou.php?firstnameis=$firstname); } how can i send the value of $firstname using POST instead of GET as the value is presently appearing in the address bar. ideally i would like using POST. NOTE = please suggest techniques that does NOT involve javascript in order to pass $firstname using POST method, as i have done the entire validations using php and i have assumed that user has javascript turned off. by the looks of it... You already have it setup right... basically you would you something like this: FORM: form method=post action=mysuperphppage.php input type=text name=txtfirstname input type=submit /form mysuperphppage.php: ?PHP $firstname = $_POST['txtfirstname']; echo HTML Thank you {$firstname}, You're the best! HTML; ? Of course, all untested, but it should get you the basics... -- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424-9337 www.raoset.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink
On Fri, August 24, 2007 3:20 am, Goltsios Theodore wrote: Please do not encourage the use of $_REQUEST. You might as well just tell people to enable register_globals again. This is *SO* not correct at all! $_REQUEST[] is merely array_merge($_GET, $_POST, $_COOKIE); It is *NOT* in any way, shape, or form, polluting the global namespace of all your variables, which is what register_globals is. Don't use http://php.net/extract on $_REQUEST would be the same as enabling register_globals again. There is no real difference from a SECURITY stand-point between GET or POST or COOKIE. They are all equally trivial to inject any data the user chooses. Using $_GET versus $_POST (versus $_COOKIE) is an issue of code clarity -- You know that the data is expected to come from the URL or the POST data. It is not, repeat not, an issue of Security. There could easily be a script written which is expected to respond to GET or POST data in the same way, particularly a simplistic web-service that doesn't really care if the web Designers prefer to have buttons or links or CSS links that look like buttons or CSS buttons that look like links or rabid squirrels that send the GET and/or POST data to make the HTTP request. So the blanket statement to never use $_REQUEST is probably ill-advised. Use $_POST when you expect the data to always be in POST data. Use $_GET when you expect the data to alwasy be in GET data. If you actually want to accept HTTP requests of either kind for flexibility to an external user, by all means use REQUEST. You must, of course, also factor in that you should never ever use POST for a non-idempotent operation. Or, in layman's terms, if the script *changes* data, use POST and not GET. That is a totally separate reason to choose POST over GET or vice versa. ymmv naiaa ianal -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink
On Fri, August 24, 2007 6:34 am, Suamya Srivastava wrote: by doing this can i disable the register_globals? You can disable register_globals by using these: $_GET['foo'] $_POST['foo'] $_REQUEST['foo']; $_COOKIES['foo']; $_SESSION['foo']; $_ENV['foo']; $_SERVER['foo']; and never, ever, ever, use just plain old $foo for data that was supposed to come from GET/POST/COOKIE/REQUEST/SESSION/... register_globals has absolutely nothing to do with whether the session data is getting passed along or not by either Cookie or TransId. register_globals has everything to do with whether you know that you are getting external data or internal data. You, and others on this list in response to you, have conflated two very distinct and different issues into one giant snarled knot. Don't do that. :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink
On 8/26/07, Richard Lynch [EMAIL PROTECTED] wrote: This is *SO* not correct at all! $_REQUEST[] is merely array_merge($_GET, $_POST, $_COOKIE); Yes and it mimics being lazy - allowing overriding values from $_POST vs. $_GET vs. $_COOKIE depending on what the programmer wants to trust It encourages poor practices. There is no reason to not name the proper source of data - i.e. i want it from POST not GET It is *NOT* in any way, shape, or form, polluting the global namespace of all your variables, which is what register_globals is. That is why I said it was *one* reason register_globals was disabled - global namespace was probably the biggest reason, but also variable overriding and sloppyness allowing for exploits was probably up there too. There could easily be a script written which is expected to respond to GET or POST data in the same way, particularly a simplistic web-service that doesn't really care if the web Designers prefer to have buttons or links or CSS links that look like buttons or CSS buttons that look like links or rabid squirrels that send the GET and/or POST data to make the HTTP request. Yes, there could. But part of that would rely on a *very* motivated end-user (or we'll call them hacker) - they would probably find a way in or do what they want either way. There's no reason to make it easier just because well they can hack something up to do that anyway - that's a Microsoft approach to security. Whatever happened to people at least trying to discourage abuse or issues. I have never used $_REQUEST and my applications don't seem to have any issues. Obviously someone could have tried to switch POST/GET on me, but I still ensure proper bounds checking/sanity checking/type checking/etc. But I would not allow someone to issue a GET variable to override a cookie value without having to make the extra effort (and furthermore understand how the variables work on the server side to make it actually work how they want.) Use $_POST when you expect the data to always be in POST data. correct. Use $_GET when you expect the data to alwasy be in GET data. correct. If you actually want to accept HTTP requests of either kind for flexibility to an external user, by all means use REQUEST. In my opinion a properly coded web application shouldn't be lazy and should know the source of data. So I consider this incorrect. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink
On Sun, August 26, 2007 6:37 pm, mike wrote: On 8/26/07, Richard Lynch [EMAIL PROTECTED] wrote: It is *NOT* in any way, shape, or form, polluting the global namespace of all your variables, which is what register_globals is. That is why I said it was *one* reason register_globals was disabled - global namespace was probably the biggest reason, but also variable overriding and sloppyness allowing for exploits was probably up there too. I'll say it again: regsiter_globals has *NOTHING* to do with $_REQUEST. Zero. Zilch. Nada. Zip. There could easily be a script written which is expected to respond to GET or POST data in the same way, particularly a simplistic web-service that doesn't really care if the web Designers prefer to have buttons or links or CSS links that look like buttons or CSS buttons that look like links or rabid squirrels that send the GET and/or POST data to make the HTTP request. Yes, there could. But part of that would rely on a *very* motivated end-user (or we'll call them hacker) - they would probably find a way in or do what they want either way. No, it only relies on one Designer who wants their request to look like a FORM and another Designer who wants their request to look like a link. And I don't really *CARE* if the search terms (or whatever input it its) comes from GET versus POST as there is NO Security difference whatsoever. They need equal filtration. There's no reason to make it easier just because well they can hack something up to do that anyway - that's a Microsoft approach to security. Whatever happened to people at least trying to discourage abuse or issues. The point is not that they can hack something up to use GET instead of POST and make it work. The point is that GET and/or POST are equally tainted data, and that I wish to provide the same services to either kind of request, and there is NO DIFFERENCE between them for this service. I have never used $_REQUEST and my applications don't seem to have any issues. Obviously someone could have tried to switch POST/GET on me, but I still ensure proper bounds checking/sanity checking/type checking/etc. But I would not allow someone to issue a GET variable to override a cookie value without having to make the extra effort (and furthermore understand how the variables work on the server side to make it actually work how they want.) You're still not getting the point. There *ARE* valid reasons for allowing GET and POST to be used inter-changably. Consider a stupid simple web service that lets you look up Longitude, Latitude by zip code from their own website. Do you really CARE if they use a link or a form to REQUEST the long/lat with the zip input? No. You don't. So go ahead and use REQUEST. And register_globals should be off, and using REQUEST does not undo *anything* that was done by register_globals being turned off. Use $_POST when you expect the data to always be in POST data. correct. Use $_GET when you expect the data to alwasy be in GET data. correct. If you actually want to accept HTTP requests of either kind for flexibility to an external user, by all means use REQUEST. In my opinion a properly coded web application shouldn't be lazy and should know the source of data. So I consider this incorrect. I'm sorry you feel that way. But please do NOT spread mis-information that using $_REQUEST un-does what turning register_globals off does. Because that is simply not factually correct, no matter how you feel about $_REQUEST. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink
I'll say it again: regsiter_globals has *NOTHING* to do with $_REQUEST. Zero. Zilch. Nada. Zip. To me it allows for the same [lazy] behavior. Period. I've had other people agree. Say what you want about it. No, it only relies on one Designer who wants their request to look like a FORM and another Designer who wants their request to look like a link. I've never had to write an app where I allow GET and POST. Either way can be created using a form, a button, a link, etc. Pick one and stick with it. And I don't really *CARE* if the search terms (or whatever input it its) comes from GET versus POST as there is NO Security difference whatsoever. They need equal filtration. Agreed The point is that GET and/or POST are equally tainted data, and that I wish to provide the same services to either kind of request, and there is NO DIFFERENCE between them for this service. I disagree with that approach to a web application. You're still not getting the point. No, I get it. I was too vague in my original message. To me newbies picked up PHP easily because hey, this query string variable is $foo just like when I do a post variable of $foo! and $_REQUEST to them is their way to get around a register_globals = off installation. I've seen it many times with people just learning PHP. I associate the use of $_REQUEST with people new to PHP, because I've seen it many times. Also when told about $_GET, $_POST, $_COOKIE, etc... they realized how much cleaner that is and adjust appropriately. There *ARE* valid reasons for allowing GET and POST to be used inter-changably. Consider a stupid simple web service that lets you look up Longitude, Latitude by zip code from their own website. Do you really CARE if they use a link or a form to REQUEST the long/lat with the zip input? No. You don't. You're right - I don't. But I tell them to use GET or POST and they prepare their client-side code appropriately. Both ways can be done. I don't make my applications lazy and then allow two interfaces to them when one is perfectly fine and allows for one consistent interaction method. But please do NOT spread mis-information that using $_REQUEST un-does what turning register_globals off does. Because that is simply not factually correct, no matter how you feel about $_REQUEST. Eh, you call it mis-information. I call it advising on how to code a tighter web application. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing variables to a PHP script on clicking a hyperlink
Hello, How can I pass variables on clicking a hyperlink to a PHP script? I have 5 hyperlinks, all pointing to the same PHP script. However, on clicking each hyperlink a different value of the variable needs to be passed to the PHP script. i.e. I have 5 databases from which I want to obtain information, however the information should be displayed only when the user clicks on the hyperlink for that database. How can I pass the database name to the PHP script? How would the script know which database to get information from? I am new to PHP so any help would be greatly appreciated. I hope my question is clear. Thanks, Suamya. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables to a PHP script on clicking a hyperlink
On 8/23/07, Suamya Srivastava [EMAIL PROTECTED] wrote: Hello, How can I pass variables on clicking a hyperlink to a PHP script? I have 5 hyperlinks, all pointing to the same PHP script. However, on clicking each hyperlink a different value of the variable needs to be passed to the PHP script. i.e. I have 5 databases from which I want to obtain information, however the information should be displayed only when the user clicks on the hyperlink for that database. How can I pass the database name to the PHP script? How would the script know which database to get information from? I am new to PHP so any help would be greatly appreciated. I hope my question is clear. use GET foo.php?param=value or you could use POST by using some client-side javascript to do a form submit with key/value pairs. this is a *very* simple operation... all web-enabled languages understand HTTP POST/GET/etc. - those are the main ways of exchanging data between client/server. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink
I think that you can also do that buy making a drop down list with the available databases and pass the chosen database to another (or perhaps the same) script and make the queries and output results there. You can catch the posted or got option buy using the $_REQUEST array ($_GET and $_POST are included in that like a less lame solution). Let's say you have a databases.php script that passes options to con_query.php the code could something like that: *databases.php:* ?php $label = Choose a database :; $database = array('database1','database3','database3'); # Print the headers print 'htmlheadmeta http-equiv=content-type content=text/html; charset=UTF-8titleDatabase selection/title/headbody no-repeat;'; print 'table class=outer border=0 width=100% cellpadding=10 cellspacing=10'; print ' trtd height=92px colspan=2/td/tr'; # Print the drop down form print form name='dtbases' action='con_query.php' method='POST'; print 'table border=0 trtdtable class=invistrtdnbsp;/td/tr'; print trtdb$label/b/tdtdselect name='database'; foreach ($database as $value){ print option value='$value'$value/option; } print /td/tr/select; print trtdnbsp;/td/tr; print trtd colspan=2 align=centerinput type=submit value='Submit'/td/tr; ? *con_query.php:* ?php $database = $_REQUEST['database']; print The user chose database : .$database; ? You can take now the $database containing the one chosen by the user and connect and query whatever you wan't. Have fun. mike wrote: On 8/23/07, Suamya Srivastava [EMAIL PROTECTED] wrote: Hello, How can I pass variables on clicking a hyperlink to a PHP script? I have 5 hyperlinks, all pointing to the same PHP script. However, on clicking each hyperlink a different value of the variable needs to be passed to the PHP script. i.e. I have 5 databases from which I want to obtain information, however the information should be displayed only when the user clicks on the hyperlink for that database. How can I pass the database name to the PHP script? How would the script know which database to get information from? I am new to PHP so any help would be greatly appreciated. I hope my question is clear. use GET foo.php?param=value or you could use POST by using some client-side javascript to do a form submit with key/value pairs. this is a *very* simple operation... all web-enabled languages understand HTTP POST/GET/etc. - those are the main ways of exchanging data between client/server.
[PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink
On 8/24/07, Goltsios Theodore [EMAIL PROTECTED] wrote: the posted or got option buy using the $_REQUEST array ($_GET and $_POST are included in that like a less lame solution). Let's say you have a Please do not encourage the use of $_REQUEST. You might as well just tell people to enable register_globals again. Use $_GET, $_POST, $_SESSION, $_COOKIE, $_SERVER, etc. for the appropriate source of data. $_REQUEST is laziness and introduces most of the same issues that was the reasoning behind disabling register_globals to begin with. (As for dropdowns, that's just an in-browser method of collecting data and sending the key/value pairs in POST or GET... IMHO the HTML portion should already be known before someone steps into the realm of PHP and server-side programming) - mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink
I thought I just did a comment and suggested that it is a lame solution to use $_REQUEST plus I did not know witch of the two method (POST or GET) would be appropriate so I picked up the lame way :-) . mike wrote: On 8/24/07, Goltsios Theodore [EMAIL PROTECTED] wrote: the posted or got option buy using the $_REQUEST array ($_GET and $_POST are included in that like a less lame solution). Let's say you have a Please do not encourage the use of $_REQUEST. You might as well just tell people to enable register_globals again. Use $_GET, $_POST, $_SESSION, $_COOKIE, $_SERVER, etc. for the appropriate source of data. $_REQUEST is laziness and introduces most of the same issues that was the reasoning behind disabling register_globals to begin with. (As for dropdowns, that's just an in-browser method of collecting data and sending the key/value pairs in POST or GET... IMHO the HTML portion should already be known before someone steps into the realm of PHP and server-side programming) - mike
[PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink
Thank you all for the help. I did not want to use dropdown box..that was the very reason i was wondering if I can pass the variables through a hyperlink. I used $_GET and it worked fine. However, as mentioned in the posts its not advisable to use $_REQUEST. Could you please elaborate on the reason? This brings me to another question I have registered a variable as a session variable so that I can use it on any page during that session. HOwever, this was not working when I first tried it. I read somewhere that I need to enable register_globals. On doing so, it worked and I could access my session variable on any other page. Is this wrong? Is there an alternative? Please suggest. - suamya On 8/24/07, Goltsios Theodore [EMAIL PROTECTED] wrote: the posted or got option buy using the $_REQUEST array ($_GET and $_POST are included in that like a less lame solution). Let's say you have a Please do not encourage the use of $_REQUEST. You might as well just tell people to enable register_globals again. Use $_GET, $_POST, $_SESSION, $_COOKIE, $_SERVER, etc. for the appropriate source of data. $_REQUEST is laziness and introduces most of the same issues that was the reasoning behind disabling register_globals to begin with. (As for dropdowns, that's just an in-browser method of collecting data and sending the key/value pairs in POST or GET... IMHO the HTML portion should already be known before someone steps into the realm of PHP and server-side programming) - mike -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink
In this case $_POST would be the appropriate array, since your form is using the POST method: form method=post Goltsios Theodore wrote: I thought I just did a comment and suggested that it is a lame solution to use $_REQUEST plus I did not know witch of the two method (POST or GET) would be appropriate so I picked up the lame way :-) . mike wrote: On 8/24/07, Goltsios Theodore [EMAIL PROTECTED] wrote: the posted or got option buy using the $_REQUEST array ($_GET and $_POST are included in that like a less lame solution). Let's say you have a Please do not encourage the use of $_REQUEST. You might as well just tell people to enable register_globals again. Use $_GET, $_POST, $_SESSION, $_COOKIE, $_SERVER, etc. for the appropriate source of data. $_REQUEST is laziness and introduces most of the same issues that was the reasoning behind disabling register_globals to begin with. (As for dropdowns, that's just an in-browser method of collecting data and sending the key/value pairs in POST or GET... IMHO the HTML portion should already be known before someone steps into the realm of PHP and server-side programming) - mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink
Hi.. in the settings, session.use_cookies is turned ON but session.trans_sid is turned OFF. do i need to enable this as well? by doing this can i disable the register_globals? - suamya Hi Me again Check on Your setting - ; Whether to use cookies. session.use_cookies = 1 session variable is saved here if the user have cookies turned off it will still work if your have trans-sid turn on. BTW you don't have to use a dropdown radio buttons or tick box will work as well Johan Suamya Srivastava [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thank you all for the help. I did not want to use dropdown box..that was the very reason i was wondering if I can pass the variables through a hyperlink. I used $_GET and it worked fine. However, as mentioned in the posts its not advisable to use $_REQUEST. Could you please elaborate on the reason? This brings me to another question I have registered a variable as a session variable so that I can use it on any page during that session. HOwever, this was not working when I first tried it. I read somewhere that I need to enable register_globals. On doing so, it worked and I could access my session variable on any other page. Is this wrong? Is there an alternative? Please suggest. - suamya On 8/24/07, Goltsios Theodore [EMAIL PROTECTED] wrote: the posted or got option buy using the $_REQUEST array ($_GET and $_POST are included in that like a less lame solution). Let's say you have a Please do not encourage the use of $_REQUEST. You might as well just tell people to enable register_globals again. Use $_GET, $_POST, $_SESSION, $_COOKIE, $_SERVER, etc. for the appropriate source of data. $_REQUEST is laziness and introduces most of the same issues that was the reasoning behind disabling register_globals to begin with. (As for dropdowns, that's just an in-browser method of collecting data and sending the key/value pairs in POST or GET... IMHO the HTML portion should already be known before someone steps into the realm of PHP and server-side programming) - mike -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink
Hi Me again Check on Your setting - ; Whether to use cookies. session.use_cookies = 1 session variable is saved here if the user have cookies turned off it will still work if your have trans-sid turn on. BTW you don't have to use a dropdown radio buttons or tick box will work as well Johan Suamya Srivastava [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thank you all for the help. I did not want to use dropdown box..that was the very reason i was wondering if I can pass the variables through a hyperlink. I used $_GET and it worked fine. However, as mentioned in the posts its not advisable to use $_REQUEST. Could you please elaborate on the reason? This brings me to another question I have registered a variable as a session variable so that I can use it on any page during that session. HOwever, this was not working when I first tried it. I read somewhere that I need to enable register_globals. On doing so, it worked and I could access my session variable on any other page. Is this wrong? Is there an alternative? Please suggest. - suamya On 8/24/07, Goltsios Theodore [EMAIL PROTECTED] wrote: the posted or got option buy using the $_REQUEST array ($_GET and $_POST are included in that like a less lame solution). Let's say you have a Please do not encourage the use of $_REQUEST. You might as well just tell people to enable register_globals again. Use $_GET, $_POST, $_SESSION, $_COOKIE, $_SERVER, etc. for the appropriate source of data. $_REQUEST is laziness and introduces most of the same issues that was the reasoning behind disabling register_globals to begin with. (As for dropdowns, that's just an in-browser method of collecting data and sending the key/value pairs in POST or GET... IMHO the HTML portion should already be known before someone steps into the realm of PHP and server-side programming) - mike -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink
Hi I have sessions working like a charm, i use it for my user login vars and so on, here is the settings i used. register_globals = Off session.use_cookies = 1 and switch on session.trans_sid if you know that not all your users will have cookies turned on This worked for me Johan Suamya Srivastava [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi.. in the settings, session.use_cookies is turned ON but session.trans_sid is turned OFF. do i need to enable this as well? by doing this can i disable the register_globals? - suamya Hi Me again Check on Your setting - ; Whether to use cookies. session.use_cookies = 1 session variable is saved here if the user have cookies turned off it will still work if your have trans-sid turn on. BTW you don't have to use a dropdown radio buttons or tick box will work as well Johan Suamya Srivastava [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thank you all for the help. I did not want to use dropdown box..that was the very reason i was wondering if I can pass the variables through a hyperlink. I used $_GET and it worked fine. However, as mentioned in the posts its not advisable to use $_REQUEST. Could you please elaborate on the reason? This brings me to another question I have registered a variable as a session variable so that I can use it on any page during that session. HOwever, this was not working when I first tried it. I read somewhere that I need to enable register_globals. On doing so, it worked and I could access my session variable on any other page. Is this wrong? Is there an alternative? Please suggest. - suamya On 8/24/07, Goltsios Theodore [EMAIL PROTECTED] wrote: the posted or got option buy using the $_REQUEST array ($_GET and $_POST are included in that like a less lame solution). Let's say you have a Please do not encourage the use of $_REQUEST. You might as well just tell people to enable register_globals again. Use $_GET, $_POST, $_SESSION, $_COOKIE, $_SERVER, etc. for the appropriate source of data. $_REQUEST is laziness and introduces most of the same issues that was the reasoning behind disabling register_globals to begin with. (As for dropdowns, that's just an in-browser method of collecting data and sending the key/value pairs in POST or GET... IMHO the HTML portion should already be known before someone steps into the realm of PHP and server-side programming) - mike -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink
On 8/24/07, Suamya Srivastava [EMAIL PROTECTED] wrote: Hi.. in the settings, session.use_cookies is turned ON but session.trans_sid is turned OFF. do i need to enable this as well? by doing this can i disable the register_globals? - suamya You need to make sure session_start() is called on all pages to be able to read/write the session data. This is probably the case. I have never needed to use trans_sid. It introduces some complexities that I don't think are needed. $_REQUEST is basically a new way of doing register_globals, which is a security issue. register_globals can allow a savvy user to overwrite a variable with another source - say you wanted a POST variable, a user could supply GET instead. or if you want it to come from a cookie using $_COOKIE it could be overridden using GET. If that makes sense. There's a lot of information about it. It was disabled by default a while back. Never enable it. You do not need it, period. Anyone telling you to enable it or reading somewhere you need to enable it is *absolutely* incorrect. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables
On 3/23/07, Chris [EMAIL PROTECTED] wrote: Tijnema ! wrote: On 3/22/07, Jeff [EMAIL PROTECTED] wrote: I want to thank you all for clearing me up on setting the register_globals to ON issue!! I have refrained from doing so and my code is running great with the $_GET. I am having NO trouble passing my single variable to the next page using.. echo A href=\char_edit_form.php?charid=$charid\Edit/A; as when the next page that load actually shows the character info, so basically you can see you are dealing with the correct record. NOW. I want to pass two variables to a delete page. The charid and the char name. Here is what I have but it will only pass the 1st variable ?charid echo A href=\delete_char.php?charid=$charid ?char=.$myrow[char_name].\Delete/A; I get the 1st variable using the $charid = (int)$_GET['charid']; (on the next page) I do however NOT get $charname = $_GET[char] to pull the name out. (on the next page) I've tried putting a comma, a , a % between the variables ie.. echo A href=\delete_char.php?charid=$charid ?char=.$myrow[char_name].\Delete/A; but it just won't let me pull the $_GET[char] I have even tried $_GET['char'] but am under the impression '_' are for integers and _ are for text? This is bullshit, ' and do the same. There's no need to swear at someone for asking a question. And there is a difference between ' and : ?php $animal = 'dog'; echo 'I have a $animal as a petbr/\n'; echo I have a $animal as a petbr/\n; ? Yeah, you're right... But I don't use variables like that, i'm always doing it like this: ?php $animal = 'dog'; echo 'I have a '.$animal.' as a petbr/\n'; echo I have a .$animal. as a petbr/\n; ? And then it doesn't make any difference :) Tijnema -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables
example.com?char_id=43char=Bilbo There is nothing about _ and (int) at all. And, technically, you should use an HTML Entity on the in your HTML output, so it turns into amp; On Wed, March 21, 2007 9:49 pm, Jeff wrote: I want to thank you all for clearing me up on setting the register_globals to ON issue!! I have refrained from doing so and my code is running great with the $_GET. I am having NO trouble passing my single variable to the next page using.. echo A href=\char_edit_form.php?charid=$charid\Edit/A; as when the next page that load actually shows the character info, so basically you can see you are dealing with the correct record. NOW. I want to pass two variables to a delete page. The charid and the char name. Here is what I have but it will only pass the 1st variable ?charid echo A href=\delete_char.php?charid=$charid ?char=.$myrow[char_name].\Delete/A; I get the 1st variable using the $charid = (int)$_GET['charid']; (on the next page) I do however NOT get $charname = $_GET[char] to pull the name out. (on the next page) I've tried putting a comma, a , a % between the variables ie.. echo A href=\delete_char.php?charid=$charid ?char=.$myrow[char_name].\Delete/A; but it just won't let me pull the $_GET[char] I have even tried $_GET['char'] but am under the impression '_' are for integers and _ are for text? Anyway, can someone please let me know the PROPER way to pass the two or more variables? Thanks WAY in advance!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables
On 3/22/07, Jeff [EMAIL PROTECTED] wrote: I want to thank you all for clearing me up on setting the register_globals to ON issue!! I have refrained from doing so and my code is running great with the $_GET. I am having NO trouble passing my single variable to the next page using.. echo A href=\char_edit_form.php?charid=$charid\Edit/A; as when the next page that load actually shows the character info, so basically you can see you are dealing with the correct record. NOW. I want to pass two variables to a delete page. The charid and the char name. Here is what I have but it will only pass the 1st variable ?charid echo A href=\delete_char.php?charid=$charid ?char=.$myrow[char_name].\Delete/A; I get the 1st variable using the $charid = (int)$_GET['charid']; (on the next page) I do however NOT get $charname = $_GET[char] to pull the name out. (on the next page) I've tried putting a comma, a , a % between the variables ie.. echo A href=\delete_char.php?charid=$charid ?char=.$myrow[char_name].\Delete/A; but it just won't let me pull the $_GET[char] I have even tried $_GET['char'] but am under the impression '_' are for integers and _ are for text? This is bullshit, ' and do the same. Anyway, can someone please let me know the PROPER way to pass the two or more variables? script.php?var1=value1var2=value2var3=value3 Thanks WAY in advance!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables
Since you're new to this, always be sure to clean up the output you get from $_GET or $_POST to avoid sql injection. Fore example: $search_value = htmlentities($_GET['search_value'], ENT_QUOTES); If you're casting to something other than a string (such as int) than you're safe and you don't have to use htmlentities. -- itoctopus - http://www.itoctopus.com Jeff [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thank you Chris! Chris [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jeff wrote: I want to thank you all for clearing me up on setting the register_globals to ON issue!! I have refrained from doing so and my code is running great with the $_GET. I am having NO trouble passing my single variable to the next page using.. echo A href=\char_edit_form.php?charid=$charid\Edit/A; as when the next page that load actually shows the character info, so basically you can see you are dealing with the correct record. NOW. I want to pass two variables to a delete page. The charid and the char name. Here is what I have but it will only pass the 1st variable ?charid echo A href=\delete_char.php?charid=$charid ?char=.$myrow[char_name].\Delete/A; The first one is preceded by a ? Subsequent ones are with an ''. See http://en.wikipedia.org/wiki/Query_string -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables
itoctopus wrote: Since you're new to this, always be sure to clean up the output you get from $_GET or $_POST to avoid sql injection. Fore example: $search_value = htmlentities($_GET['search_value'], ENT_QUOTES); If you're casting to something other than a string (such as int) than you're safe and you don't have to use htmlentities. Good call. One better is prepared statements. Avoid the problem all together. Travis Doherty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables
although you should be filtering input in order to avoid sql injection cross-site-scripting and other related nasties you shouldn't be using htmlentities() in order to protect against sql injection. filter the incoming data, e.g.: $a = intval($_GET['a']); // you want only integers $a = floatval($_GET['a']); // you want only floats $a = strip_text($_GET['a']); // you do want html especially go read this page and use the filter extension if you can: http://nl2.php.net/filter and then escape your data properly according to the context it is being used, e.g.: mysql_real_escape_string(); // for using data in a mysql query htmlentities(); // for using data in a webpage itoctopus wrote: Since you're new to this, always be sure to clean up the output you get from $_GET or $_POST to avoid sql injection. Fore example: $search_value = htmlentities($_GET['search_value'], ENT_QUOTES); If you're casting to something other than a string (such as int) than you're safe and you don't have to use htmlentities. -- itoctopus - http://www.itoctopus.com Jeff [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thank you Chris! Chris [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jeff wrote: I want to thank you all for clearing me up on setting the register_globals to ON issue!! I have refrained from doing so and my code is running great with the $_GET. I am having NO trouble passing my single variable to the next page using.. echo A href=\char_edit_form.php?charid=$charid\Edit/A; as when the next page that load actually shows the character info, so basically you can see you are dealing with the correct record. NOW. I want to pass two variables to a delete page. The charid and the char name. Here is what I have but it will only pass the 1st variable ?charid echo A href=\delete_char.php?charid=$charid ?char=.$myrow[char_name].\Delete/A; The first one is preceded by a ? Subsequent ones are with an ''. See http://en.wikipedia.org/wiki/Query_string -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables
Tijnema ! wrote: On 3/22/07, Jeff [EMAIL PROTECTED] wrote: I want to thank you all for clearing me up on setting the register_globals to ON issue!! I have refrained from doing so and my code is running great with the $_GET. I am having NO trouble passing my single variable to the next page using.. echo A href=\char_edit_form.php?charid=$charid\Edit/A; as when the next page that load actually shows the character info, so basically you can see you are dealing with the correct record. NOW. I want to pass two variables to a delete page. The charid and the char name. Here is what I have but it will only pass the 1st variable ?charid echo A href=\delete_char.php?charid=$charid ?char=.$myrow[char_name].\Delete/A; I get the 1st variable using the $charid = (int)$_GET['charid']; (on the next page) I do however NOT get $charname = $_GET[char] to pull the name out. (on the next page) I've tried putting a comma, a , a % between the variables ie.. echo A href=\delete_char.php?charid=$charid ?char=.$myrow[char_name].\Delete/A; but it just won't let me pull the $_GET[char] I have even tried $_GET['char'] but am under the impression '_' are for integers and _ are for text? This is bullshit, ' and do the same. There's no need to swear at someone for asking a question. And there is a difference between ' and : ?php $animal = 'dog'; echo 'I have a $animal as a petbr/\n'; echo I have a $animal as a petbr/\n; ? -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Passing variables
I was going to say the same thing, but was too busy to worry about it -Original Message- From: Chris [mailto:[EMAIL PROTECTED] Sent: Thursday, March 22, 2007 7:14 PM To: Tijnema ! Cc: php-general@lists.php.net Subject: Re: [PHP] Passing variables Tijnema ! wrote: On 3/22/07, Jeff [EMAIL PROTECTED] wrote: I want to thank you all for clearing me up on setting the register_globals to ON issue!! I have refrained from doing so and my code is running great with the $_GET. I am having NO trouble passing my single variable to the next page using.. echo A href=\char_edit_form.php?charid=$charid\Edit/A; as when the next page that load actually shows the character info, so basically you can see you are dealing with the correct record. NOW. I want to pass two variables to a delete page. The charid and the char name. Here is what I have but it will only pass the 1st variable ?charid echo A href=\delete_char.php?charid=$charid ?char=.$myrow[char_name].\Delete/A; I get the 1st variable using the $charid = (int)$_GET['charid']; (on the next page) I do however NOT get $charname = $_GET[char] to pull the name out. (on the next page) I've tried putting a comma, a , a % between the variables ie.. echo A href=\delete_char.php?charid=$charid ?char=.$myrow[char_name].\Delete/A; but it just won't let me pull the $_GET[char] I have even tried $_GET['char'] but am under the impression '_' are for integers and _ are for text? This is bullshit, ' and do the same. There's no need to swear at someone for asking a question. And there is a difference between ' and : ?php $animal = 'dog'; echo 'I have a $animal as a petbr/\n'; echo I have a $animal as a petbr/\n; ? -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.17/730 - Release Date: 3/22/2007 7:44 AM -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.446 / Virus Database: 268.18.17/730 - Release Date: 3/22/2007 7:44 AM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing variables
I want to thank you all for clearing me up on setting the register_globals to ON issue!! I have refrained from doing so and my code is running great with the $_GET. I am having NO trouble passing my single variable to the next page using.. echo A href=\char_edit_form.php?charid=$charid\Edit/A; as when the next page that load actually shows the character info, so basically you can see you are dealing with the correct record. NOW. I want to pass two variables to a delete page. The charid and the char name. Here is what I have but it will only pass the 1st variable ?charid echo A href=\delete_char.php?charid=$charid ?char=.$myrow[char_name].\Delete/A; I get the 1st variable using the $charid = (int)$_GET['charid']; (on the next page) I do however NOT get $charname = $_GET[char] to pull the name out. (on the next page) I've tried putting a comma, a , a % between the variables ie.. echo A href=\delete_char.php?charid=$charid ?char=.$myrow[char_name].\Delete/A; but it just won't let me pull the $_GET[char] I have even tried $_GET['char'] but am under the impression '_' are for integers and _ are for text? Anyway, can someone please let me know the PROPER way to pass the two or more variables? Thanks WAY in advance!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables
Jeff wrote: I want to thank you all for clearing me up on setting the register_globals to ON issue!! I have refrained from doing so and my code is running great with the $_GET. I am having NO trouble passing my single variable to the next page using.. echo A href=\char_edit_form.php?charid=$charid\Edit/A; as when the next page that load actually shows the character info, so basically you can see you are dealing with the correct record. NOW. I want to pass two variables to a delete page. The charid and the char name. Here is what I have but it will only pass the 1st variable ?charid echo A href=\delete_char.php?charid=$charid ?char=.$myrow[char_name].\Delete/A; The first one is preceded by a ? Subsequent ones are with an ''. See http://en.wikipedia.org/wiki/Query_string -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables
Thank you Chris! Chris [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Jeff wrote: I want to thank you all for clearing me up on setting the register_globals to ON issue!! I have refrained from doing so and my code is running great with the $_GET. I am having NO trouble passing my single variable to the next page using.. echo A href=\char_edit_form.php?charid=$charid\Edit/A; as when the next page that load actually shows the character info, so basically you can see you are dealing with the correct record. NOW. I want to pass two variables to a delete page. The charid and the char name. Here is what I have but it will only pass the 1st variable ?charid echo A href=\delete_char.php?charid=$charid ?char=.$myrow[char_name].\Delete/A; The first one is preceded by a ? Subsequent ones are with an ''. See http://en.wikipedia.org/wiki/Query_string -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing Variables
Ok, all I am new to PHP MySQL. (please don't let this scare you off) I had my site hosted with Gisol.com and due to their very poor service and tech support I left them for Lunarpages.com who so far have a better service and their tech support is excellent!! But my pages won't pass variables any more. When I started I purchased two books MySQL and PHP MySQL both published by O'Riely. So far the are excellent help and instructors. I wote some pages where I track users and their characters from an on-line game called World of Warcraft. On the Gisol server they were working EXCELLENT!! Once I moved to Lunarpages, the pages load ok but they don't pass the variables from one page to another. The below code queries the db and list's the user's in a table, and has a hyperlink to the right of each, on Gisol I could click the link and it would load the view_char.php page and it listed their character and the info i needed, and gave options to delete and edit. Again it was working beautifully. VIEW USERS PAGE CODE: $sql=SELECT f_name, l_name, char_id, char_name, char_level FROM t_char, t_users where t_users.user_id = t_char.user_link ORDER BY char_name ASC; mysql_select_db($db_select,$db); $result = mysql_query($sql,$db); echo TABLE border=2; echoTRTDBCharacter Name/BTDBCharacter Level/BTDBOwner/B/TR; while ($myrow = mysql_fetch_array($result)) { echo TRTD.$myrow[char_name].TD.$myrow[char_level].TD.$myrow[f_name]. .$myrow[l_name]; echo TDA href=\view_char.php?charid=.$myrow[char_id].\View/A; } //$charid=[.$myrow[char_id].]; - I tried this line with no success. Possibly have it in the wrong place?? echo/TABLE; VIEW_CHAR PAGE CODE $sql = SELECT * FROM `t_char` WHERE `t_char`.`char_id` = '$charid'; -- now all this does is produce a blank page... used to work great! //$sql = SELECT * FROM `t_char` WHERE `t_char`.`char_id` = '21'; - i used this code to test the page w/o the $charid string and it works FINE!! $result=mysql_query( $sql ); if (!$result) { die(Could not query the database: br /.mysql_error()); } I wrote a help ticket to Lunarpages where I am now hosted and asked them to set the register_globals to ON thinking this was the problem based on what I've read and the wrote back and told me that they use suPHP to parse php files and I have the option of using custom php.ini files. That I could create a .htaccess file or put individual php.ini files in the folder that contains the files im running. In other words do it myself. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing Variables
On Wed, March 14, 2007 9:14 pm, Jeff wrote: I've read and the wrote back and told me that they use suPHP to parse php files and I have the option of using custom php.ini files. That I could create a .htaccess file or put individual php.ini files in the folder that contains the files im running. In other words do it myself. You *could* create a file named .htaccess and put this in it: php_value register_globals on and your scripts will work as-is. It would be INFINITELY BETTER to fix up the scripts so that instead of using just $charid in the query, you would do like this at the tip-top: $charid = mysql_real_escape_string($_GET['charid']); This will take care of the register globals and it will keep you safe from SQL-injection attack. At the moment, if you turn on register_globals, it will work, but it's very very very un-safe without the MySQL escaping anyway, so you might as well fix both at once. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [php] passing variables doesn't work
Every HTTP request is separate. Nothing is preserved from one to the next unless you program it to be preserved. You can pass around hidden inputs. You can use sessions. You can store stuff in the DB. You can use shared memory. But ain't nothing gonna get shared that you don't make it be shared. That's by DESIGN so that HTTP and PHP can scale up by just throwing more servers into a web farm. Any bottle-neck you create with your data-sharing is your bottle-neck, by your choice, with your architecture, that you have to fix when it breaks because you need to handle 100 million hits a second. It ain't PHP's or HTTP's problem, though, cuz they're designed to handle that by just buying more servers. :-) On Wed, October 25, 2006 2:46 am, WILLEMS Wim \(BMB\) wrote: Dear all, I am trying to pass variables from one php-file to another but that doesn't seem to work. Anyone an idea what I am doing wrong? The first file shows a dropdown with all the databases on the server (only 1 for me). You have to select a database and put an SQL query in the textarea. Pushing Execute query! then calls the second file test2.php which should put all the variables on the screen (first there was another routine but that did not work, so I created this simple output to test the veriables). html head title PHP SQL Code Tester /title /head body !--query.php-- ?php $host=localhost; $user=some_user; $password=some password; ? form action=test2.php method=post Please select the database for the query:brbr select name=database size=1 ?php $wim = 5; /* this is added to test the passing of the variables - doesn't work either */ $link = mysql_connect($host, $user, $password) or die( Cannot connect : . mysql_error()); $db_table = mysql_list_dbs(); for ($i = 0; $i mysql_num_rows($db_table); $i++) { echo(option . mysql_tablename($db_table, $i)); } ? /select Please input the SQL query to be executed:brbr textarea name=query cols=50 rows=10/textarea brbr input type=submit value=Execute query! /form /body /html This routine which is called with the routine above should print all variables but it doesn't. Well, the routine itself works but the variables are empty. html head titlePHP SQL code tester/title /head body !-- test2.php-- ?php echo Dit is een testbr; /* this is printed to the screen */ echo $wim; /* this is NOT printed to the screen */ echo $hostbr;/* only the BR is printed */ echo $databasebr;/* only the BR is printed */ echo query: $querybr;/* only the BR is printed */ echo Dit is test 2;/* this is printed to the screen */ ? /body /html Thanks for your help, Wim. DISCLAIMER http://www.proximus.be/maildisclaimer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [php] passing variables doesn't work
Dear all, I am trying to pass variables from one php-file to another but that doesn't seem to work. Anyone an idea what I am doing wrong? The first file shows a dropdown with all the databases on the server (only 1 for me). You have to select a database and put an SQL query in the textarea. Pushing Execute query! then calls the second file test2.php which should put all the variables on the screen (first there was another routine but that did not work, so I created this simple output to test the veriables). html head title PHP SQL Code Tester /title /head body !--query.php-- ?php $host=localhost; $user=some_user; $password=some password; ? form action=test2.php method=post Please select the database for the query:brbr select name=database size=1 ?php $wim = 5; /* this is added to test the passing of the variables - doesn't work either */ $link = mysql_connect($host, $user, $password) or die( Cannot connect : . mysql_error()); $db_table = mysql_list_dbs(); for ($i = 0; $i mysql_num_rows($db_table); $i++) { echo(option . mysql_tablename($db_table, $i)); } ? /select Please input the SQL query to be executed:brbr textarea name=query cols=50 rows=10/textarea brbr input type=submit value=Execute query! /form /body /html This routine which is called with the routine above should print all variables but it doesn't. Well, the routine itself works but the variables are empty. html head titlePHP SQL code tester/title /head body !-- test2.php-- ?php echo Dit is een testbr;/* this is printed to the screen */ echo $wim; /* this is NOT printed to the screen */ echo $hostbr; /* only the BR is printed */ echo $databasebr; /* only the BR is printed */ echo query: $querybr; /* only the BR is printed */ echo Dit is test 2; /* this is printed to the screen */ ? /body /html Thanks for your help, Wim. DISCLAIMER http://www.proximus.be/maildisclaimer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [php] passing variables doesn't work
WILLEMS Wim (BMB) wrote: Dear all, I am trying to pass variables from one php-file to another but that doesn't seem to work. Anyone an idea what I am doing wrong? The first file shows a dropdown with all the databases on the server (only 1 for me). You have to select a database and put an SQL query in the textarea. Pushing Execute query! then calls the second file test2.php which should put all the variables on the screen (first there was another routine but that did not work, so I created this simple output to test the veriables). html head title PHP SQL Code Tester /title /head body !--query.php-- ?php $host=localhost; $user=some_user; $password=some password; ? form action=test2.php method=post Please select the database for the query:brbr select name=database size=1 ?php $wim = 5; /* this is added to test the passing of the variables - doesn't work either */ $link = mysql_connect($host, $user, $password) or die( Cannot connect : . mysql_error()); $db_table = mysql_list_dbs(); for ($i = 0; $i mysql_num_rows($db_table); $i++) { echo(option . mysql_tablename($db_table, $i)); } ? /select Please input the SQL query to be executed:brbr textarea name=query cols=50 rows=10/textarea brbr input type=submit value=Execute query! /form /body /html This routine which is called with the routine above should print all variables but it doesn't. Well, the routine itself works but the variables are empty. html head titlePHP SQL code tester/title /head body !-- test2.php-- ?php echo Dit is een testbr;/* this is printed to the screen */ echo $wim; /* this is NOT printed to the screen */ You're relying on register_globals being on. That's not going to work in 99% of the cases, it's a security issue. Instead everything goes into the $_POST array: echo $_POST['wim'] . br/; If the form action was get instead of post it would go into the $_GET array. You should also read up on sanitizing user input and sql injection. http://www.phpsec.org/ has quite a few good links on the subject(s). -- Postgresql php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [php] passing variables doesn't work
Whatever form information you want to pass has to be part of the form. WILLEMS Wim (BMB) wrote: select name=database size=1 In the second script, the value of this will be in $_POST[database]. ?php $wim = 5; /* this is added to test the passing of the variables - doesn't work either */ $wim isn't part of your form - it will /not/ get saved into the next PHP script. You can handle it through input type hidden elements in the form, or through sessions, for example, depending on what you want to do with it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [php] passing variables doesn't work
http://google.com/search?q=phpmyadmin phpmyadmin has all the functionality you are trying to build - and it implements it securely - even if you are writing the code/tool mentioned below as a learning exercise (as opposed to writing it because you need to be able to execute arbitrary queries easily) then the source of the phpmyadmin project is a good resource. WILLEMS Wim (BMB) wrote: Dear all, I am trying to pass variables from one php-file to another but that doesn't seem to work. Anyone an idea what I am doing wrong? The first file shows a dropdown with all the databases on the server (only 1 for me). You have to select a database and put an SQL query in the textarea. Pushing Execute query! then calls the second file test2.php which should put all the variables on the screen (first there was another routine but that did not work, so I created this simple output to test the veriables). html head title PHP SQL Code Tester /title /head body !--query.php-- ?php $host=localhost; $user=some_user; $password=some password; ? form action=test2.php method=post Please select the database for the query:brbr select name=database size=1 ?php $wim = 5; /* this is added to test the passing of the variables - doesn't work either */ $link = mysql_connect($host, $user, $password) or die( Cannot connect : . mysql_error()); $db_table = mysql_list_dbs(); for ($i = 0; $i mysql_num_rows($db_table); $i++) { echo(option . mysql_tablename($db_table, $i)); } ? /select Please input the SQL query to be executed:brbr textarea name=query cols=50 rows=10/textarea brbr input type=submit value=Execute query! /form /body /html This routine which is called with the routine above should print all variables but it doesn't. Well, the routine itself works but the variables are empty. html head titlePHP SQL code tester/title /head body !-- test2.php-- ?php echo Dit is een testbr; /* this is printed to the screen */ echo $wim; /* this is NOT printed to the screen */ echo $hostbr;/* only the BR is printed */ echo $databasebr;/* only the BR is printed */ echo query: $querybr;/* only the BR is printed */ echo Dit is test 2;/* this is printed to the screen */ ? /body /html Thanks for your help, Wim. DISCLAIMER http://www.proximus.be/maildisclaimer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [php] passing variables doesn't work
On Wed, 25 Oct 2006 10:19:24 +0200, Max Belushkin wrote: Whatever form information you want to pass has to be part of the form. WILLEMS Wim (BMB) wrote: select name=database size=1 In the second script, the value of this will be in $_POST[database]. ... which will contain absolutely nothing, since you haven't provided any value: optionblabla/option does not contain a value that can be sent to the next page. And, don't build the link to the database (and possibly spawn an error) when you're right into your HTML and just printed select to the screen. If the connection fails, the error will most likely not show up, you'll have an empty select box, we'll get a new question from you etc. Ivo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing variables.
Hello, I've used like 3 hours to get this done but I can't figure this out. Hope someone here can help. I have a form that a user can use to edit www pages. Page content is stored in DB as a HTML code. First user has to select, from select menu, which page to edit. Then the selected page content html is retrieved to a textarea where it can be edited with tinyMCE editor. Then there's two buttons. Publish to save the edited content back to DB (no problems there) and Preview to open the full page layout in a popup window. The problem is that I can't pass the edited data from the textarea to the popup window. Here's last (desperate) attempt: table width=800 border=0 tr td colspan=2Edit/td /tr tr td colspan=2 textarea name=Edited cols=100 rows=40 id=? echo $tinymcestatus; ? ?php $result=mysql_query(SELECT ContentData FROM x_pages WHERE id = '$ID'); $ContentData = mysql_fetch_row($result); print $ContentData[0]; ? /textarea /td /tr tr td script language=JavaScript function Preview() { window.open('preview.php?page=?php echo $ContentData[0] ?', 'popup', 'width=900, height=900, top=0, left=0, menubar=0, scrollbars=1, location=1, toolbar=0, resizable=1, status=0'); } /script input type=submit name=Submit value=Publish input type=button onclick=Preview(''); return false; value=Preview / /td /tr /table When I echo $page at the preview.php window it prints some of the data to page and some to address line??? And this is not even the edited data. I should pass The variable $Edited but I can't get it to work Thanks a LOT -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables.
My Humble suggestion is possibly: upon preview, actually post the edited data to a temp table, and then pull the HTML from the temp table to display the preview page. Currently you are passing the original content to the preview page. And You might want to look to see if javascript has any functions for escaping html entities for your GET variable.. To get the edited content you will need to get the contents of the text area in the javascript, not pass the original PHP variable (as this will be the original content) -Brad William Stokes wrote: Hello, I've used like 3 hours to get this done but I can't figure this out. Hope someone here can help. I have a form that a user can use to edit www pages. Page content is stored in DB as a HTML code. First user has to select, from select menu, which page to edit. Then the selected page content html is retrieved to a textarea where it can be edited with tinyMCE editor. Then there's two buttons. Publish to save the edited content back to DB (no problems there) and Preview to open the full page layout in a popup window. The problem is that I can't pass the edited data from the textarea to the popup window. Here's last (desperate) attempt: table width=800 border=0 tr td colspan=2Edit/td /tr tr td colspan=2 textarea name=Edited cols=100 rows=40 id=? echo $tinymcestatus; ? ?php $result=mysql_query(SELECT ContentData FROM x_pages WHERE id = '$ID'); $ContentData = mysql_fetch_row($result); print $ContentData[0]; ? /textarea /td /tr tr td script language=JavaScript function Preview() { window.open('preview.php?page=?php echo $ContentData[0] ?', 'popup', 'width=900, height=900, top=0, left=0, menubar=0, scrollbars=1, location=1, toolbar=0, resizable=1, status=0'); } /script input type=submit name=Submit value=Publish input type=button onclick=Preview(''); return false; value=Preview / /td /tr /table When I echo $page at the preview.php window it prints some of the data to page and some to address line??? And this is not even the edited data. I should pass The variable $Edited but I can't get it to work Thanks a LOT -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing variables.
At 4:44 PM +0300 6/8/06, William Stokes wrote: I have a form that a user can use to edit www pages. Page content is stored in DB as a HTML code. First user has to select, from select menu, which page to edit. Then the selected page content html is retrieved to a textarea where it can be edited with tinyMCE editor. Then there's two buttons. Publish to save the edited content back to DB (no problems there) and Preview to open the full page layout in a popup window. The problem is that I can't pass the edited data from the textarea to the popup window. Here's last (desperate) attempt: -snip- When I echo $page at the preview.php window it prints some of the data to page and some to address line??? And this is not even the edited data. I should pass The variable $Edited but I can't get it to work My opinion is that you're running into the classic problem of how to get javascript variables into php variables. As I see it, you have three ways to do this (anyone think I'm wrong, please correct me): 1. You place them into your dB with js and then pull them back out in php: http://www.devshed.com/c/a/MySQL/Loading-JavaScript-Arrays-with-MySQL-Data/ 2. You use ajax and plug the js variables values into like php variables. If you want to go this route, it's not complicated -- I can demonstrate. Please let me know. 3. You can try in your html using an id=Edited for js and a name=Edited for php -- it worked for a previous like-problem posted on this list. But I don't know if it's applicable in your case. hth's tedd -- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing Variables from Script to Script
What is the best way to pass a variable value from one script to another? In unix or dos all I would need to do would be to add them just after the name of the script such as myscript.bat thanks Alan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing Variables from Script to Script
PHP has those variables in $argv $argc tells you how many args there were. $argv[0] is the actual script name, eg, myscript.php On Sat, April 8, 2006 2:58 pm, Alan Schneider wrote: What is the best way to pass a variable value from one script to another? In unix or dos all I would need to do would be to add them just after the name of the script such as myscript.bat thanks Alan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] passing variables with HTTP_GET_VARS
Can someone show me a simple example of how to make variables availble to all pages in my site via $http_post_vars and $http_get_vars. just say I have a page index.php and that is doing a calucualtion and creating a couple of variables called $age and $height. How so I make these variables globally available and how do all the other pages show/retrieve them?? Many Thanks AD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing variables with HTTP_GET_VARS
AndreaD wrote: [ snip ] just say I have a page index.php and that is doing a calucualtion and creating a couple of variables called $age and $height. How so I make these variables globally available and how do all the other pages show/retrieve them?? Andrea: What you are looking for are session variables. These variables are persistant, and are available via the $_SESSION superglobal array. Start at http://www.php.net/session for examples. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php