[PHP] IE won't post on Windows, but will on Mac
Hello, All, I've given myself two black eyes and a bloody nose on this one, and I'm sure it's a simple solution. I have a form on the php page "entry.php": At the top of that page, I have the PHP code: With IE 5.2 on Mac, I submit this form and I see "POST" echoed at the top of the page. With IE 5.5 on Windows, I submit this form and I see "GET". How? Why? What the? I've tried playing with different encoding types and content-types, and nothing changes the results. I also tried setting my IE 5.5 security settings to lowest and enabled everything possible. No matter what I do, I can't POST the form. Can anyone tell me just what in tarnation is going on here? Many many thanks... Jed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IE won't post on Windows, but will on Mac
Hi Martin, Thanks for responding. I just checked for any post variables and none were set. The problem revealed itself because I originally had: And "do something else" was always being done. Any other thoughts? Thanks again... Jed On the threshold of genius, Martin Towell wrote: > Have you checked the $_POST (or $HTTP_POST_VAR) variable to make sure it IS > using GET? > > Martin > > > -Original Message- > From: Jed Verity [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, September 03, 2002 3:19 PM > To: [EMAIL PROTECTED] > Subject: [PHP] IE won't post on Windows, but will on Mac > > > Hello, All, > > I've given myself two black eyes and a bloody nose on this one, and I'm sure > it's a simple solution. I have a form on the php page "entry.php": > > > > > > At the top of that page, I have the PHP code: > >echo "$REQUEST_METHOD"; > //other stuff... > ?> > > With IE 5.2 on Mac, I submit this form and I see "POST" echoed at the top of > the page. > > With IE 5.5 on Windows, I submit this form and I see "GET". > > How? Why? What the? I've tried playing with different encoding types and > content-types, and nothing changes the results. I also tried setting my IE > 5.5 security settings to lowest and enabled everything possible. No matter > what I do, I can't POST the form. Can anyone tell me just what in tarnation > is going on here? > > Many many thanks... > Jed > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Caching Problem
Hi, Roland, There might be a better way to do this, but you could try to use the header() function after your upload takes place to redirect the browser to the same page, using GET. Something like... http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."); } ?> Or something like that. HTH, Jed On the threshold of genius, Roland Swingler wrote: > Hi > > I have a problem with caching on IE 5.1.4 on Mac Os X. (PHP 4.0.5) > > The page I want to use is a simple file upload page that works by: > > if ($HTTP_POST_VARS['submit'] == "submit") { > then upload the file... > } > ?> > Rest of document. > > The form action returns to the same page (to allow you to upload another > file). > > This works fine, but if you press the refresh btn, the file keeps uploading > pictures. If you click in the address bar & press return, this does not > happen. > > I have included the http headers to prevent caching as described in the > documentation, but this hasn't seemed to work. > > Is this a quirk of the browser/os combination or is there something i'm > missing. > > TIA > > Roland > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Caching Problem
Oops. There was an extra period at the end there (after PHP_SELF). http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']"); } ?> On the threshold of genius, Jed Verity wrote: > Hi, Roland, > > There might be a better way to do this, but you could try to use the > header() function after your upload takes place to redirect the browser to > the same page, using GET. Something like... > > if ($HTTP_POST_VARS['submit'] == "submit") { > then upload the file... > header("Location: http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."); > } > ?> > > Or something like that. HTH, > Jed > > On the threshold of genius, Roland Swingler wrote: > >> Hi >> >> I have a problem with caching on IE 5.1.4 on Mac Os X. (PHP 4.0.5) >> >> The page I want to use is a simple file upload page that works by: >> >> > if ($HTTP_POST_VARS['submit'] == "submit") { >> then upload the file... >> } >> ?> >> Rest of document. >> >> The form action returns to the same page (to allow you to upload another >> file). >> >> This works fine, but if you press the refresh btn, the file keeps uploading >> pictures. If you click in the address bar & press return, this does not >> happen. >> >> I have included the http headers to prevent caching as described in the >> documentation, but this hasn't seemed to work. >> >> Is this a quirk of the browser/os combination or is there something i'm >> missing. >> >> TIA >> >> Roland >> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL and Array's REALLY simple question but I'm notGETTING it .. Ugh..
Hello, Steve, When you call mysql_fetch_array the first time, you are accessing the data from the first row of your results and then moving the pointer to the next row. So, when you call mysql_fetch_array the second time, it is already starting with the second row of your results. Try something like this instead: "); mysql_select_db("actionregs", $sql2); $top_level = mysql_query("SELECT * FROM williams", $sql2) or die("Could not do query "); print ""; print "Action IDOwnerTechnologySummary"; while ($tabledata = mysql_fetch_array($top_level)) { echo ""; echo "$tabledata[0]"; echo "$tabledata[6]"; echo "$tabledata[2]"; echo "$tabledata[3]"; echo ""; } print ""; ?> You may need to pull the table data array items into variables before echoing them. Does this work? HTH! Jed On the threshold of genius, Steve Gaas wrote: > Can anyone tell me what's wrong with my code? All I get output from this is > the LAST row of data from my Database. There are 2 rows, how do I make it > pull data from all of the rows? It's not going through the loop like it > should I need to be able to tell the mysql_fetch_array which row I want > in each it iteration of the for loop. The For loop increments counter, but > there is no syntax to add $counter to the result_type. The same goes with > fetch_row... > > What am I forgetting!!?? I know it's something simple > > > *** > > $sql2 = mysql_connect("localhost", "eweb", "dbfun") > or die("Could not connect "); > > mysql_select_db("actionregs", $sql2); > > $top_level = mysql_query("SELECT * FROM williams", $sql2) > or die("Could not do query "); > > $sql2_results = mysql_fetch_array($top_level); > $query_sql2_rows = mysql_num_rows($top_level); > > echo $query_sql2_rows; > // echo's 2 rows > > print " cellpadding=4 width=90%>"; > > print "Action ID width=100>OwnerTechnologySummary"; > > for ($counter=0; $counter < $query_sql2_rows; $counter++) { > $tabledata = mysql_fetch_array($top_level); > echo "$tabledata[0]"; > echo "$tabledata[6]"; > echo "$tabledata[2]"; > echo "$tabledata[3]"; > echo ""; > } > print ""; > > Thanks. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array - Match
Hello Chandu, You can use in_array(needle, haystack) for this. For example, if (in_array("abc",$subs)) {item found, do stuff...} HTH! Jed On the threshold of genius, N. Pari Purna Chand wrote: > > I have $sub = "abc"; > > and > > $subs[0] = "cde"; > $subs[0] = "iyu"; > $subs[0] = "abc"; > .. > .. > .. > $subs[50] = "xyx"; > > How to find whether $sub matches with any one of $subs[$i] > I have used a for loop but it is > returning true when $subs[$i] = "xabc". > > /Chandu > > > --- > Powered by MihiraMail, Fast secure & reliable > Brought to you by Mihira Net Pvt Ltd. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upload Progress
There really isn't a great solution for this, that I know of. It's one of the few things that makes an argument for ASP over PHP, as far as I'm concerned (if you have the luxury of choosing). Below is what I did once to try to get around the problem. It worked *okay*. The bummer is that I had to ask people to enter the size of their file in a field. (Rough estimates were okay.) Then, as soon as somebody hit the submit button on my form, I popped up a small, modal, progress bar sized window that was actually two frames. I passed the file size value from the form field to the top frame. In the bottom frame, JavaScript created a bordered equal in pixel length to the number of MB of the file being uploaded. The top frame, a PHP doc, would then refresh every three seconds, executing a filesize() on the uploaded file, converting it to MB, rounding up, and then using DHTML to resize the width of a blue-gradient gif contained in the of the bottom frame of the progress bar window. Typically, this worked okay for me. It wasn't the prettiest progress bar in the world, but it did the trick for most people. HTH! Jed On the threshold of genius, Jacob Miller wrote: > Everything I've read says that there is no way to display the progress of a > file upload (via a form) using PHP. > > I'm currently working on a site which will regularly be accepting very > large uploads, anywhere from 10 to 250+ mb and I really need a way to > display the progress of the upload so that it doesn't appear as if the > browser has frozen for a few hours. > > Any suggestions for a solution? > > thanks > -jacob > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upload Progress
Sorry, I wrote too quickly. I meant that the file size field value is passed to the bottom frame. And JavaScript is used to resize the gif, not DHTML. (Used to be DHTML when I was adding nbsp instead of resizing an image.) HTH, Jed On the threshold of genius, Jed Verity wrote: > There really isn't a great solution for this, that I know of. It's one of > the few things that makes an argument for ASP over PHP, as far as I'm > concerned (if you have the luxury of choosing). Below is what I did once to > try to get around the problem. It worked *okay*. > > The bummer is that I had to ask people to enter the size of their file in a > field. (Rough estimates were okay.) Then, as soon as somebody hit the submit > button on my form, I popped up a small, modal, progress bar sized window > that was actually two frames. I passed the file size value from the form > field to the top frame. In the bottom frame, JavaScript created a bordered > equal in pixel length to the number of MB of the file being uploaded. > The top frame, a PHP doc, would then refresh every three seconds, executing > a filesize() on the uploaded file, converting it to MB, rounding up, and > then using DHTML to resize the width of a blue-gradient gif contained in the > of the bottom frame of the progress bar window. > > Typically, this worked okay for me. It wasn't the prettiest progress bar in > the world, but it did the trick for most people. > > HTH! > Jed > > > On the threshold of genius, Jacob Miller wrote: > >> Everything I've read says that there is no way to display the progress of a >> file upload (via a form) using PHP. >> >> I'm currently working on a site which will regularly be accepting very >> large uploads, anywhere from 10 to 250+ mb and I really need a way to >> display the progress of the upload so that it doesn't appear as if the >> browser has frozen for a few hours. >> >> Any suggestions for a solution? >> >> thanks >> -jacob >> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Upload Progress
Yikes, I sort of lied. It's been awhile... Clients uploaded files from an intranet server to an external servier via their browser and ftp_put. It wasn't local machine to remote server. Sorry! Best of luck, Jed P.S. I wonder, though, if there isn't some way to execute a script with exec() to get the info through the file system. There was some talk awhile back about using flush(), too. If you haven't already, check the archives for that one... On the threshold of genius, Jacob Miller wrote: > I was considering this option earlier but I couldn't figure out how to > determine the tmp file name of the file being uploaded (in cases where > there is more than one upload in progress at a time). How did you go about > determining the name of the tmp file? > > thanks > > - Jacob > > At 01:29 09/09/2002, you wrote: >> There really isn't a great solution for this, that I know of. It's one of >> the few things that makes an argument for ASP over PHP, as far as I'm >> concerned (if you have the luxury of choosing). Below is what I did once to >> try to get around the problem. It worked *okay*. >> >> The bummer is that I had to ask people to enter the size of their file in a >> field. (Rough estimates were okay.) Then, as soon as somebody hit the submit >> button on my form, I popped up a small, modal, progress bar sized window >> that was actually two frames. I passed the file size value from the form >> field to the top frame. In the bottom frame, JavaScript created a bordered >> equal in pixel length to the number of MB of the file being uploaded. >> The top frame, a PHP doc, would then refresh every three seconds, executing >> a filesize() on the uploaded file, converting it to MB, rounding up, and >> then using DHTML to resize the width of a blue-gradient gif contained in the >> of the bottom frame of the progress bar window. >> >> Typically, this worked okay for me. It wasn't the prettiest progress bar in >> the world, but it did the trick for most people. >> >> HTH! >> Jed >> >> >> On the threshold of genius, Jacob Miller wrote: >> >>> Everything I've read says that there is no way to display the progress of a >>> file upload (via a form) using PHP. >>> >>> I'm currently working on a site which will regularly be accepting very >>> large uploads, anywhere from 10 to 250+ mb and I really need a way to >>> display the progress of the upload so that it doesn't appear as if the >>> browser has frozen for a few hours. >>> >>> Any suggestions for a solution? >>> >>> thanks >>> -jacob >>> >> >> >> -- >> 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] Upload Progress
You're right about it costing more money. But we had one server handling a bunch of uploads, most of them over 25 MB, and 99% being instigated by very impatient, not very technical, people. People who kept canceling and canceling, despite our directions, because they thought it was stuck or frozen or taking too long. It was worth $150 for us to buy the ASP component (I think we used ABCUpload, maybe?). The development time required for a creative PHP solution -- and one that might not have worked as well -- would have been dramatically more expensive than the almost out-of-the-box solution with ASP's components. (And much of the site was already written in ASP.) Other than that, you'll get know argument from me about ASP vs. PHP. I'm head over heels for PHP and, in any context other than the one stated above (and maybe one or two others), I would choose to use God Blessed PHP over anything else. Cheers! Jed P.S. I knew I'd get some fighters with that comment. Haven't learned my lesson yet... ;-) On the threshold of genius, Jay Blanchard wrote: > [snip] > There really isn't a great solution for this, that I know of. It's one of > the few things that makes an argument for ASP over PHP, as far as I'm > concerned (if you have the luxury of choosing). Below is what I did once to > try to get around the problem. It worked *okay*. > [/snip] > > How does this argue for ASP over PHP? I don't see how. File upload on PHP is > built in and therefore free. ASP file upload mechs cost more money. And, > having used ASP for a while, and having looked for this feature, no upload > progress bar exists there either. And PHP is a language, where ASP is a > service ... please do not confuse the two. If you want to argue VBScript vs. > PHP , well ,come on ... let's go. :^] PHP can beat VBScript with one > curly-brace tied behind its back. > > I mentioned a while back, when this came up before (see the archives) that > this could probably be done with an IFRAME in the upload dialog box. Now I > haven't given this much thought, but maybe it could be done. The largest > problem that I see is the communication back and forth between client and > server. The server would have to know the original size of the file at the > point the upload is started, then it would be checked for original_size > minus bits_uploaded, flush the reults to the IFRAME drawing a GD graph, and > continue to do this as it went on. > > Another method is to start the upload with a non-progressive animation that > quits when is_upload_file() returns true. > > Jay > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Javascript to PHP?
Hello, Folks, My apologies if this has been asked a thousand times. I've just joined the list. I can't find any information on passing JavaScript variables to PHP on the same page (i.e. not through the POST information of a submitted form). Is this because it's not possible? To take the load off the server, I'm trying to do a bunch of string manipulations and loops in JavaScript and then hand that info off to PHP once it's done. Any insight is appreciated! Thanks, Jed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Javascript to PHP?
That's what I was afraid of. It makes sense, of course...I was just hoping there was some kind of hack. Thanks for responding! Jed I liked it when John Holmes wrote this to me: > Not possible. You must refresh the page to send something back to PHP. > Only workaround is using a hidden frame or layer and refreshing that... > > ---John Holmes... > >> -Original Message- >> From: Jed Verity [mailto:[EMAIL PROTECTED]] >> Sent: Saturday, June 29, 2002 3:14 PM >> To: [EMAIL PROTECTED] >> Subject: [PHP] Javascript to PHP? >> >> Hello, Folks, >> >> My apologies if this has been asked a thousand times. I've just joined > the >> list. >> >> I can't find any information on passing JavaScript variables to PHP on > the >> same page (i.e. not through the POST information of a submitted form). > Is >> this because it's not possible? >> >> To take the load off the server, I'm trying to do a bunch of string >> manipulations and loops in JavaScript and then hand that info off to > PHP >> once it's done. >> >> Any insight is appreciated! Thanks, >> Jed >> >> >> -- >> 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] Javascript to PHP?
Hello, Chris, Many thanks for the thorough description. It does make sense, of course...I was just hoping that there was some kind of funky loophole that small brains like mine couldn't comprehend. Thanks again! Jed I liked it when Chris Shiflett wrote this to me: > Jed Verity wrote: > >> I can't find any information on passing JavaScript variables to PHP on the >> same page (i.e. not through the POST information of a submitted form). Is >> this because it's not possible? >> > Basically, this is not possible. > > A common area of confusion to those new to Web programming is the > distinction between client-side and server-side code. PHP is an example > of a server-side scripting language, while JavaScript is client-side. To > PHP, anything that is not PHP is simply output. It doesn't matter if the > output is HTML, JavaScript, XML, an image, etc. - it's all "not PHP." > > When a user requests a PHP script, the PHP part of the script is > executed prior to the output being sent to the client. Remember, the > output may contain JavaScript. Once the output reaches the browser, the > browser will attempt to render the HTML, execute the JavaScript, and > whatever else is appropriate. So, to get back to your question, you are > wanting to know how to have the browser (which is executing the > JavaScript) be able to send a JavaScript variable to PHP (which could be > thousands of miles away on whatever Web server the page was obtained > from) "on the same page," which means you want to be able to do this > without communicating back to the Web server. > > So, your question can be summarized into: > > "How can my browser send data back to the Web server without any further > communication with the Web server?" > > Hopefully that explains how it is impossible. > > The terms server-side and client-side are ignored by most people, > understandably, because this industry is littered with useless terms > that do little to describe what is really happening (in the case of "Web > services," the term is actually misleading in my opinion). However, > these terms are very descriptive, and once you can begin to understand > which code is executed on the server-side (by the Web server prior to > sending the response to the Web client) and which code is executed on > the client-side (by the Web client after receiving the response from the > Web server), all of these types of questions will make more sense to you. > > Hope that gives a good description of the difference and can help you > solve whatever problem you're currently working on. > > Chris > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie Q: Fetching vs. Looping
Hello Again, Folks, I've been testing this for a while and keep coming up with mixed results. In general, is it faster and more efficient to query a MySQL database once with a large SQL select statement and then loop through the huge resulting table? Or does it make better sense to perform a number of smaller queries with smaller resulting tables? This is the kind of stuff they just don't seem to talk about in the manuals. Any insight is appreciated. Sorry for the ignorant question! Jed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Javascript to PHP?
Thanks for the response, Erik! I think I will try passing the data in a cookie to a "hidden" frame, refreshing the frame, and then reading the data back. Many thanks to all for the suggestions! Cheers, Jed I liked it when Erik Price wrote this to me: > > On Saturday, June 29, 2002, at 03:13 PM, Jed Verity wrote: > >> I can't find any information on passing JavaScript variables to PHP on >> the >> same page (i.e. not through the POST information of a submitted form). >> Is >> this because it's not possible? >> >> To take the load off the server, I'm trying to do a bunch of string >> manipulations and loops in JavaScript and then hand that info off to PHP >> once it's done. > > How will you communicate with PHP without submitting an HTTP request of > some sort? So, really, you will need to submit -something-, though it > could be GET data, POST data, or COOKIE data. > > You can't have JavaScript talk to PHP "within the same page" since the > webserver/PHP "forgets" all information related to that page as soon as > it shoots it to the user-agent. > > I'm assuming you know how to use JavaScript to set a cookie, and/or make > a new request with GET or POST data attached. If not, let me know. > > > Erik > > > > > > > Erik Price > Web Developer Temp > Media Lab, H.H. Brown > [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php