[PHP] newbie question about one php script passing control to another
Hello. I am new to php programming, but have spent many years programming in many other languages, most recently perl (with which php seems to have much in common!). In every other language I've worked with there is a way for one program to pass control to another. However, so far in all of the books and other documentation I've looked at for php, I cannot find a way for one php program to pass control to another. Is this possible in php, and, if so, please let me know how. Thank you. Rod Clay [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie question about one php script passing control to another
Yes, let me try to say more about exactly what I'm trying to do. I have a php script running in a browser window (opened specifically for this purpose) in which the user keys a blog item, then hits 'submit.' After this script has successfully added the new blog item to the database, what I'd like to do is automatically close this window, and pass control to the php script that displays the updated list of blog items (with of course the newly added blog item) in the original browser window (the window the user was looking at when s/he clicked on the 'Add a blog' link). [EMAIL PROTECTED] wrote: Im not sure I understand the question. Pass control from index.php to welcome.php ??? index.php : "; ?> welcome.php That kind of pass control? Hello. I am new to php programming, but have spent many years programming in many other languages, most recently perl (with which php seems to have much in common!). In every other language I've worked with there is a way for one program to pass control to another. However, so far in all of the books and other documentation I've looked at for php, I cannot find a way for one php program to pass control to another. Is this possible in php, and, if so, please let me know how. Thank you. Rod Clay [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] WAMP servers
Hello. Does anyone use a WAMP server? And, if so, have you found one to be better than another? I am using a WAMP server entitled, aptly enough, WampServer (formerly WAMP5). In the few weeks I have been using it, I frequently get messages that a certain library or routine cannot be found. My question therefore is: do these WAMP servers typically come with all of the php libraries and subroutines that are most commonly needed? I have the impression that this WAMP server does not have some of the libraries and subroutines I need (or would very much benefit from having, anyway). Thanks for any information you can give me about WAMP servers. Rod Clay [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie needs help with session variables
Hi. I'm still very new to php and still trying to learn the ropes. I'm working on some code now trying to set up a session and use session variables in different scripts, but I'm getting this message: *Warning*: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in *Unknown* on line *0 *2 questions: 1) I've turned on register_globals in all of my php.ini files and restarted the webserver, but I'm still getting this message. Can anyone help me with this? 2) I get the idea that one should NOT turn on register_globals, but, if I don't do this, how do I share session variables between scripts (and avoid this message)? Thanks for any help that anyone can provide. Rod Clay [EMAIL PROTECTED] *
[PHP] newbie with php/HTML question
I've written my php script to accept either: 1) url parameters, when first invoked (so in this case I'm getting variables out of the $_GET global array), but then I create a form with method=PUT and, when this form is submitted and comes back into this same php script, I'm looking for 2) variables in the $_PUT global array However, I tested this just now and, for some reason I can't fathom, though the form I create has method=PUT, when it is submitted and comes back to my php script, $_SERVER['REQUEST_METHOD'] still contains "GET". Am I missing something fairly obvious here (quite possible!)? Once my php script is invoked with parameters in the url (i.e., implicit GET method), am I not able to create a form with method=PUT and have this form come back into my php script with values in the $_PUT global array?? Thanks for any help anyone can give me! I'm stumped! Rod Clay [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie with php/HTML/HTTP question
I've written my php script to accept either: 1) url parameters, when first invoked (so in this case I'm getting variables out of the $_GET global array), but then I create a form with method=PUT and, when this form is submitted and comes back into this same php script, I'm looking for 2) variables in the $_PUT global array However, I tested this just now and, for some reason I can't fathom, though the form I create has method=PUT, when it is submitted and comes back to my php script, $_SERVER['REQUEST_METHOD'] still contains "GET". Am I missing something fairly obvious here (quite possible!!)? Once my php script is invoked with parameters in the url (i.e., implicit GET method), am I not able to create a form with method=PUT and have this form come back into my php script with values in the $_PUT global array?? Thanks for any help anyone can give me! I'm stumped! Rod Clay [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie with php/HTML question
Wow, thanks. I can't believe I made this mistake. This group is sooo helpful. I could probably have looked at this another 10 hours and not seen this. Thanks again. Also, I'd like to apologize for the double post. I posted the first with an email address different from the one I subscribed to the list with and I thought it wouldn't be accepted, so posted the second with the "correct" email address. Surprisingly, they both posted! Not sure how this happened. Stut wrote: On 27 Apr 2008, at 22:40, Rod Clay wrote: I've written my php script to accept either: 1) url parameters, when first invoked (so in this case I'm getting variables out of the $_GET global array), but then I create a form with method=PUT and, when this form is submitted and comes back into this same php script, I'm looking for 2) variables in the $_PUT global array However, I tested this just now and, for some reason I can't fathom, though the form I create has method=PUT, when it is submitted and comes back to my php script, $_SERVER['REQUEST_METHOD'] still contains "GET". Am I missing something fairly obvious here (quite possible!)? Once my php script is invoked with parameters in the url (i.e., implicit GET method), am I not able to create a form with method=PUT and have this form come back into my php script with values in the $_PUT global array?? Thanks for any help anyone can give me! I'm stumped! You want POST not PUT. Nearly all browsers don't currently support PUT requests. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] newbie with another HTML/navigation question
I have a php script that is invoked on 2 different occasions: 1) the first to create a page with a form the user will use to input information for a new table row - this form has method=POST 2) the script is run a second time to accept the input from the completed form, add the new row to the table on the database, then create a simple form with an "OK" button the user will click on to go to another page to view the result of the database maintenance - this form has method=GET Everything is working great EXCEPT THAT the url parameter I attempt to pass on the second form to the php script that displays the database maintenance never gets there! It's on the second form (method="get" action="bloglist.php?thread=yet%20another%20new%20thread">) but the bloglist.php script doesn't receive it. The query string is empty when bloglist.php starts. Also, another very curious, and perhaps revealing, thing - when I attempt to view the page source of the second form I mention above, the one with method=GET, I get the odd, and absolutely nonsensical, message "The page you are trying to view contains POSTDATA that has expired from the cache." But this makes no sense, since this second page (with method=GET) has (or should have) no POSTDATA!?! Can anyone make any sense of any of this for me? I'm making pretty good progress in general, but, once again, I seem to have hit a snag here I'm don't seem to be able to get past. Thanks for any help you can give me. Rod [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] is there a problem with php script pulling HTML out of database as it writes the page??
Hello. Again, I'm fairly new to php so please forgive me if my question is a very simple or obvious one. I've just tried testing for the first time some php code that is pulling text out of a database to print it on the webpage. Some of this text includes HTML, specifically in this case an statement. Much to my surprise, this is not working. Is there a problem with pulling HTML out of a database like this as the page is being written? There's no problem of course if my php code is writing the HTML to the page - in this case, the statement works fine and the image is displayed. Why is it a problem when my php script pulls the HTML code out of a database and writes it to the page from there?? It would appear that when my php script writes HTML to the page a process of some kind is executed to, in this case, get the image and put it on the page. Apparently this same process is NOT executed if the HTML is retrieved from a database and simply written to the page from there. Is this correct? And, if it is, can anyone suggest a workaround, another way to get done what I'm trying to do here? Thanks for any help you can give me. Rod Clay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is there a problem with php script pulling HTML out of database as it writes the page??
Yes, here's the code that is retrieving "news items" from the database and printing them on the page (I do some other stuff with the text before, and after, I print it, for example, find the sentences, so I can print complete sentences, and not just pieces of sentences). As I say, occasionally these news items contain some HTML, e.g., the src="xxx"> statement. All of the text is being correctly retrieved from the database and written to the page, including the src="xxx"> statement, because I see it all in the page source of the page in my browser. However, the statement is NOT working, that is, the image does NOT appear on the page. $result = mysql_query("SELECT * FROM newsitem ORDER BY newsitem_date DESC"); if (mysql_num_rows($result) > 0) { $i = 1; while (($row = mysql_fetch_assoc($result)) && ($i < 6)) { ?> = $row['title']; echo $title; echo " by "; ?> $row['author']; echo " of "; echo $row['newsservice']; ?> echo ""; $url_string = " (read more of this article)"; echo $url_string; $blog_result = mysql_query("SELECT * FROM blog where discussion = \"$title\""); if (mysql_num_rows($blog_result) > 0) $not = ""; else $not = " not"; echo ""; echo "This news item does$not have a blog discussion "; echo " "; if (mysql_num_rows($blog_result) > 0) echo "Read this item's blog "; else echo "Start a discussion on this item "; $i++; ?> Stut wrote: On 15 Jul 2008, at 22:36, Rod Clay wrote: Hello. Again, I'm fairly new to php so please forgive me if my question is a very simple or obvious one. I've just tried testing for the first time some php code that is pulling text out of a database to print it on the webpage. Some of this text includes HTML, specifically in this case an src="x"> statement. Much to my surprise, this is not working. Is there a problem with pulling HTML out of a database like this as the page is being written? There's no problem of course if my php code is writing the HTML to the page - in this case, the statement works fine and the image is displayed. Why is it a problem when my php script pulls the HTML code out of a database and writes it to the page from there?? It would appear that when my php script writes HTML to the page a process of some kind is executed to, in this case, get the image and put it on the page. Apparently this same process is NOT executed if the HTML is retrieved from a database and simply written to the page from there. Is this correct? And, if it is, can anyone suggest a workaround, another way to get done what I'm trying to do here? Code please, we're not mind readers! -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is there a problem with php script pulling HTML out of database as it writes the page??
It's (was) not printing anything. Here's the doctype statement: "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> HOWEVER, thanks for all of the responses so far, but please accept my apologies because evidently this is NOT a php question after all - I just tried another, much, much smaller photo and that is printing, so it would appear that it is a much more mundane problem, actually an HTML problem!!! Again, please accept my apologies for this false alarm, but I had tested and tested and tested this and was stumped an hour ago! Thought it was a different kind of problem. Mea culpa! :-[ dg wrote: On Jul 15, 2008, at 3:06 PM, Rod Clay wrote: All of the text is being correctly retrieved from the database and written to the page, including the statement, because I see it all in the page source of the page in my browser. However, the statement is NOT working, that is, the image does NOT appear on the page. What exactly is it printing? What is the doctype? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[Fwd: Re: [PHP] is there a problem with php script pulling HTML out of database as it writes the page??]
Sorry, I'm back again with this same problem! Apparently the only reason it looked like it was solved an hour ago was because the src="xx"> statement I tried reading out of the database was pointing to an image already on the page! When the statement points to an image NOT already on the page, it doesn't work. I thought the size of the image might be the problem, but no matter how small I make the image, it doesn't work. Again, any insight into what might be the problem here would be MUCH appreciated. Is it necessary for an statement to be in the code of the script writing the page for the image to be correctly inserted onto the page? I believe that's the question. It looks like when the statement is pulled from a database and copied onto the webpage, some kind of php or HTML parser doesn't get a chance to parse it, resolve it, and go retrieve the image to put it on the page!!! I hope I'm wrong about this, but at this point I don't have any other plausible theory!! --- Begin Message --- Yes, here's the code that is retrieving "news items" from the database and printing them on the page (I do some other stuff with the text before, and after, I print it, for example, find the sentences, so I can print complete sentences, and not just pieces of sentences). As I say, occasionally these news items contain some HTML, e.g., the src="xxx"> statement. All of the text is being correctly retrieved from the database and written to the page, including the src="xxx"> statement, because I see it all in the page source of the page in my browser. However, the statement is NOT working, that is, the image does NOT appear on the page. $result = mysql_query("SELECT * FROM newsitem ORDER BY newsitem_date DESC"); if (mysql_num_rows($result) > 0) { $i = 1; while (($row = mysql_fetch_assoc($result)) && ($i < 6)) { ?> = $row['title']; echo $title; echo " by "; ?> $row['author']; echo " of "; echo $row['newsservice']; ?> echo ""; $url_string = " (read more of this article)"; echo $url_string; $blog_result = mysql_query("SELECT * FROM blog where discussion = \"$title\""); if (mysql_num_rows($blog_result) > 0) $not = ""; else $not = " not"; echo ""; echo "This news item does$not have a blog discussion "; echo " "; if (mysql_num_rows($blog_result) > 0) echo "Read this item's blog "; else echo "Start a discussion on this item "; $i++; ?> Stut wrote: On 15 Jul 2008, at 22:36, Rod Clay wrote: Hello. Again, I'm fairly new to php so please forgive me if my question is a very simple or obvious one. I've just tried testing for the first time some php code that is pulling text out of a database to print it on the webpage. Some of this text includes HTML, specifically in this case an src="x"> statement. Much to my surprise, this is not working. Is there a problem with pulling HTML out of a database like this as the page is being written? There's no problem of course if my php code is writing the HTML to the page - in this case, the statement works fine and the image is displayed. Why is it a problem when my php script pulls the HTML code out of a database and writes it to the page from there?? It would appear that when my php script writes HTML to the page a process of some kind is executed to, in this case, get the image and put it on the page. Apparently this same process is NOT executed if the HTML is retrieved from a database and simply written to the page from there. Is this correct? And, if it is, can anyone suggest a workaround, another way to get done what I'm trying to do here? Code please, we're not mind readers! -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End Message --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[Fwd: [Fwd: Re: [PHP] is there a problem with php script pulling HTML out of database as it writes the page??]]
OK. Once again, a problem I thought was abstruse and formidable turns out to be ridiculously simple and embarrassingly obvious (once you realize what it is - image not in web server directory!!!) But I didn't know until this happened that the browser sends a follow-up request to the web server for the images it finds specified on the page. This is a very useful piece of knowledge!! It made it obvious that I was looking for the problem in all the wrong places! Sorry for the false alarm. Next time I'll try to have a real problem everyone can sink their teeth into!! --- Begin Message --- Sorry, I'm back again with this same problem! Apparently the only reason it looked like it was solved an hour ago was because the src="xx"> statement I tried reading out of the database was pointing to an image already on the page! When the statement points to an image NOT already on the page, it doesn't work. I thought the size of the image might be the problem, but no matter how small I make the image, it doesn't work. Again, any insight into what might be the problem here would be MUCH appreciated. Is it necessary for an statement to be in the code of the script writing the page for the image to be correctly inserted onto the page? I believe that's the question. It looks like when the statement is pulled from a database and copied onto the webpage, some kind of php or HTML parser doesn't get a chance to parse it, resolve it, and go retrieve the image to put it on the page!!! I hope I'm wrong about this, but at this point I don't have any other plausible theory!! --- Begin Message --- Yes, here's the code that is retrieving "news items" from the database and printing them on the page (I do some other stuff with the text before, and after, I print it, for example, find the sentences, so I can print complete sentences, and not just pieces of sentences). As I say, occasionally these news items contain some HTML, e.g., the src="xxx"> statement. All of the text is being correctly retrieved from the database and written to the page, including the src="xxx"> statement, because I see it all in the page source of the page in my browser. However, the statement is NOT working, that is, the image does NOT appear on the page. $result = mysql_query("SELECT * FROM newsitem ORDER BY newsitem_date DESC"); if (mysql_num_rows($result) > 0) { $i = 1; while (($row = mysql_fetch_assoc($result)) && ($i < 6)) { ?> = $row['title']; echo $title; echo " by "; ?> $row['author']; echo " of "; echo $row['newsservice']; ?> echo ""; $url_string = " (read more of this article)"; echo $url_string; $blog_result = mysql_query("SELECT * FROM blog where discussion = \"$title\""); if (mysql_num_rows($blog_result) > 0) $not = ""; else $not = " not"; echo ""; echo "This news item does$not have a blog discussion "; echo " "; if (mysql_num_rows($blog_result) > 0) echo "Read this item's blog "; else echo "Start a discussion on this item "; $i++; ?> Stut wrote: On 15 Jul 2008, at 22:36, Rod Clay wrote: Hello. Again, I'm fairly new to php so please forgive me if my question is a very simple or obvious one. I've just tried testing for the first time some php code that is pulling text out of a database to print it on the webpage. Some of this text includes HTML, specifically in this case an src="x"> statement. Much to my surprise, this is not working. Is there a problem with pulling HTML out of a database like this as the page is being written? There's no problem of course if my php code is writing the HTML to the page - in this case, the statement works fine and the image is displayed. Why is it a problem when my php script pulls the HTML code out of a database and writes it to the page from there?? It would appear that when my php script writes HTML to the page a process of some kind is executed to, in this case, get the image and put it on the page. Apparently this same process is NOT executed if the HTML is retrieved from a database and simply written to the page from there. Is this correct? And, if it is, can anyone suggest a workaround, another way to get done what I'm trying to do here? Code please, we're not mind readers! -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End Message --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php--- End Message --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] storing and then displaying HTML for update
I'm writing a php application which includes accepting and storing HTML for routine display by the application. All of this seems to be working fine. However, I also want to display the raw HTML for administrators of the system to update as necessary. I just discovered that this does NOT seem to be working. When I attempt to put this raw HTML into a textarea field on my page, I get unpredictable results. There must be a way to do this, since I've seen this done in other php applications. Can someone tell me how to do this? Is there some way to do this other than to put all of this raw HTML into a textarea field, or is there some technique for getting it successfully into a textarea field? I'm stumped right now. Thanks for any help anyone can give me. Rod -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] storing and then displaying HTML for update
Daniel Brown wrote: Ooh, top-posting and privately replying! You're going to jail, Rod! ;-P On Fri, Jul 25, 2008 at 10:05 AM, Rod Clay <[EMAIL PROTECTED]> wrote: Occasionally part of the HTML. Usually nothing. Right, but what I had hoped for was an sample of actual output, along with a sample of *expected* output. Oops, sorry, I can't get used to the bottom-posting convention after spending 20 years usually top-posting! :-[ Well, I believe I've found my problem, and, once again, I am embarrassed to say that it is a pretty simple and foolish error on my part. I was putting this HTML in a "value=" parameter in the textarea field, instead of just putting it between the and tags It's amazing how simple these problems are once you know the solution, and how difficult and exasperating they seem to be when you don't! Thanks to everyone who helped me wrestle with this. Your input is much appreciated, and always helpful, no matter what the solution turns out to be.
[PHP] remembering where the user is on the page??
I'm creating a website in php and I've noticed that many websites seem to "remember where the user is on the page," so that, for example, the user can click on a link and go to another page, but, when the user comes back to the original page, it is displayed so that the user is looking at the same part of the page that s/he was looking at when s/he clicked the link. This is a mystery to me! How do you create a webpage so that it "remembers" where the user is on the page and takes her/him back to that same place on the page when the user returns? There must be some "trick" to making this happen because a lot of pages do it and a lot don't (like mine! :-( ). But I'd like to make mine do it too!! Thanks for any light you can shed for me on this "mystery." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php