[PHP] Writing to specific place in file?
I'm trying to modify a PHP form processor script that writes to files. It writes to text files fine, but I would like it to write to a specific place in a file because I want the file to contain HTML tags. I can start this file out by having the proper HTML tags at the top of the file because it just appends to the file. The problem is that the file won't have the proper page closing tags. If I put those tags in the file, the next time the script writes to the file, it writes the variables below the closing HTML tags, so now the page has content outside the HTML tags. I'd like it to be able to write new text right below the previous entry, not to the end of the file. I'm thinking I need to tag each entry with an identifier, have the script search for the last identifier, then write the new entry below that. The only problem is, I don't know how to do this. Is there another way to do this? Thanks, John __ Do You Yahoo!? Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] mail() function not sending to Yahoo address
I've tried several PHP form processors, and all of them have trouble sending the form contents to a Yahoo address. When I change the address to something other than a Yahoo account, it sends the form results with no problem. Is there an issue with PHP's mail function and Yahoo email addresses? thanks, John __ Do You Yahoo!? Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail() function not sending to Yahoo address
I found out it was my SMTP server that was actually having the problem sending to Yahoo accounts, not PHP. I changed which server my PHP script used to send mail and it sent it to my Yahoo account no problem. John --- Alex Shi <[EMAIL PROTECTED]> wrote: > Hi, > > > Monday, February 04, 2002, 12:17:27 AM, recebi de > John P. Donaldson: > > > > John> I've tried several PHP form processors, and > all of > > John> them have trouble sending the form contents > to a Yahoo > > John> address. When I change the address to > something other > > John> than a Yahoo account, it sends the form > results with > > John> no problem. Is there an issue with PHP's > mail > > John> function and Yahoo email addresses? > > > > check your SMTP server in the configuration of PHP > > Could you please further suggest how to check and > what should > be check for this issue, and what could be a concern > in php configuration > regarding to Yahoo account? > > Thanks! > > Alex > > > > > > > Ricardo J. Veludo > > e-mail: [EMAIL PROTECTED] > > > > > > -- > > 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 > __ Do You Yahoo!? Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ereg_replace help
I have a file open and can successfully write to it, but I was to be able to search for a certain string of text and replace it with a string of text. I can't figure out how to construct a proper ereg_replace statement to search through this file and do the replacing. Examples I've seen are in the manner of: $text = "line1\nline2\n"; fputs(ereg_replace("\n", "", $text)); But how do I set the value of $text to be the entire contents of the text file I've got open so it can search through the entire file to find matches and replace those matches? Any help is greatly appreciated. Thanks, John __ Do You Yahoo!? Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ereg_replace help
I'm not actually replacing \n with , I just used that as an example. When I tried Martin's solution, I got a parse error on this line: $content = implode($lines, "\n",); I checked the manual and it's constructed properly .. I think. What could be giving me the parse error on this line. The previous line reads: $lines = file("log.txt"); Thanks, John --- Mike Frazer <[EMAIL PROTECTED]> wrote: > nl2br() would serve that purpose as well. See the > Strings section of the > Functions Reference in the manual. > > Mike Frazer > > > > "Martin Towell" <[EMAIL PROTECTED]> wrote in > message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > $lines = file("filename_here.blah"); // read in > file as an array > > $content = implode("\n", $lines); // join it > all back together > > $new_cont = ereg_replace("from", "to", $content); > > fopen(...); fputs(..., $new_content); > fclose(...); > > > > > > if your intent is to replace all new lines with > 's then use this > instead > > ... > > > > $lines = file("filename_here.blah"); // read in > file as an array > > $content = implode("", $lines); // join it > all back together > > fopen(...); fputs(..., $content); fclose(...); > > > > > > hope this helps > > > > -Original Message- > > From: John P. Donaldson > [mailto:[EMAIL PROTECTED]] > > Sent: Monday, February 04, 2002 3:39 PM > > To: php > > Subject: [PHP] ereg_replace help > > > > > > I have a file open and can successfully write to > it, > > but I was to be able to search for a certain > string of > > text and replace it with a string of text. I > can't > > figure out how to construct a proper ereg_replace > > statement to search through this file and do the > > replacing. Examples I've seen are in the manner > of: > > > > $text = "line1\nline2\n"; > > fputs(ereg_replace("\n", "", $text)); > > > > But how do I set the value of $text to be the > entire > > contents of the text file I've got open so it can > > search through the entire file to find matches and > > replace those matches? Any help is greatly > > appreciated. > > > > Thanks, > > John > > > > __ > > Do You Yahoo!? > > Great stuff seeking new owners in Yahoo! Auctions! > > http://auctions.yahoo.com > > > > -- > > 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 > __ Do You Yahoo!? Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] create dynamic pulldown menu?
I am trying to create a pulldown menu based on the contents of a directory. Is there any way for PHP to read a directory and create the menu based on the files in that directory. It should create this menu dynamically each time the page is viewed, so if a file is deleted from that directory, it doesn't show up in the pulldown menu, if one is added, it shows up. So if the directory has two files in it, 1-2-2002.txt and 3-5-2002.txt, it will add these entries to the menu: 1-2-2002 3-5-2002 TIA John __ Do You Yahoo!? Send FREE Valentine eCards with Yahoo! Greetings! http://greetings.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] write to specific place in file
How do I write to a specific place in a file instead of just using fputs to append text to the end of the file? Thanks, John __ Do You Yahoo!? Yahoo! Sports - live college hoops coverage http://sports.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] displaying form data
I have a form processor that displays a confirmation screen showing the submitted form values to the user after they submit the form. This confirmation screen's contents are generated by the script itself. However, I'd like to be able to redirect the results to any pre-existing webpage. For example, if the form had a field named "Name," I'd like to have the value of that displayed in an webpage after they submit it. I tried doing this by including the field name $Name in the webpage, having the form processor read this webpage in using fread, then printing it out from the script, but the page renders without the value of $Name. How can I do this? I know I can do this by including the HTML code to output within the script, but I need the webpage that displays the data to be an external file. Any help would be greatly appreciated. Thanks, John __ Do You Yahoo!? Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] character problem
I've created a PHP script that is called from a form to send an email. The contents of the email is a hidden value in the form named "info," and is typically a paragraph of text. It works fine, however, for some reason, the apostrophy character always gets emailed looking like this: /' I've tried everything to get around this. Any ideas? Here's my script and form: Form: Email this product info to a friend Script file named emailsender.php: The product info has been mailed to: $email"; $to = $email; $sender ="[EMAIL PROTECTED]"; MAIL( "$email", # address to send $info email to "Product Info", # subject "$info", # hidden form field containing text to email "From: $sender\nX-Mailer: PHP/" . phpversion()); ?> Thanks in advance, John __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail - only $35 a year! http://personal.mail.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]