Go Back  DVD Talk Forum > General Discussions > Tech Talk
Reload this Page >

problem with PHP script

Tech Talk Discuss PC Hardware, Software, Internet and Other Technology

problem with PHP script

Old 07-23-04, 01:07 PM
  #1  
Mod Emeritus
Thread Starter
 
Gallant Pig's Avatar
 
Join Date: Aug 1999
Posts: 15,325
Likes: 0
Received 0 Likes on 0 Posts
problem with PHP script

Basically I'm trying to take data from a form, and html code from an html file, do a find & replace taking data from the html code and switching it with what someone enters into the form.

So:

1 Enter Your Name: Alex

2 Type what HTML File You Want To Edit

3 Pull Data from HTML file and Put into Variable

4 Find & Replace the word YOURNAME with Alex

5 Output HTML: It'd be best if I could make this "savable", but I'd settle for just printing the entire html file to the current browser like print $html.


Everything should be right, form file, the correct files are where they need to be in terms in the right directory, etc.

Does this seem correct? When I run this I just get "0". I can't get the file to even be read & displayed.
Old 07-24-04, 03:29 AM
  #2  
DVD Talk Special Edition
 
Join Date: Dec 2003
Posts: 1,052
Likes: 0
Received 0 Likes on 0 Posts
I'm no php expert, but try:
PHP Code:
$HTMLCODE str_replace("$oldWord""$newWord""$HTMLCODE"); 
Old 07-24-04, 05:30 AM
  #3  
DVD Talk Gold Edition
 
Join Date: Feb 1999
Location: HB, CA
Posts: 2,601
Likes: 0
Received 0 Likes on 0 Posts
I think you want to use file_get_contents() not readfile().
Old 07-29-04, 08:10 PM
  #4  
Mod Emeritus
Thread Starter
 
Gallant Pig's Avatar
 
Join Date: Aug 1999
Posts: 15,325
Likes: 0
Received 0 Likes on 0 Posts
Thanks belboz & all. I think both worked, I messed with the quotes and it seemed to work both ways.

Guys the next thing would be cool is to take data stored in a variable and then output it so it prompts the user to save the file on their machine with a certain file name.

So from that above, taking the code from $HTMLCODE and force a prompt to come out and ask someone to save it on their machine.

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Thread Tools
Search this Thread

Archive - Advertising - Cookie Policy - Privacy Statement - Terms of Service - Do Not Sell My Personal Information

Copyright 2018 MH Sub I, LLC dba Internet Brands. All rights reserved. Use of this site indicates your consent to the Terms of Use.