Jump to content

darkfact

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Everything posted by darkfact

  1. nevermind. It was late and I was over-thinking it. I just added to my str_replace and replace record51 with the value of $ident. The form won't allow it if it already exists and all I needed was a unique name for each entry. Problem solved. Thanks
  2. My first question is what is this line doing? $ident2 = ($ident . 2); $ident2 returns the value of $ident with a 2 appended to it. and what is contained in the $_POST['indent']? An alpha numeric value--whatever is entered in the form. You say you are trying to increment a numerical value but I cannot see that in your code. I would like to increment the 2 instances of record51 to record52 and increment again each time the process is initiated.
  3. I'm trying to increment a numerical value and after several hours of reading haven't come up with a solution. this may be too much information but here it is; I'm using this code to change the values in r5include.html <?php $ident = $_POST['ident']; ?> <?php $ident2 = ($ident . 2); $filename = 'r5include.html'; $string = file_get_contents($filename); $old = array("'images/up.jpg'","add.html' target='_blank'"); $new = array("'$ident/$ident2.jpg'","$ident.html' target='iframe2'"); $data = str_replace($old,$new,$string); $handle = fopen($filename, "w+"); fwrite($handle,$data); fclose($handle); ?> but before I do that I'm copying the original to a temp file with this code: <?php $filename = 'r5include.html'; $string = file_get_contents($filename); $tempfile = 'temp.html'; $handle = fopen($tempfile, "a"); fwrite($handle,$string); fclose($handle); ?> This is what goes to temp.html: <img height=75 src='images/up.jpg' hidefocus='true' usemap='#record51' /> <map name='record51'> <area shape='rect' coords='0,0,75,75' href='add.html' target='_blank'> I would like to increment the 2 instances of record51 to record52 and increment again each time the process is initiated. And then append it to r5include with this: <?php $myFile = "r5include.html"; $fh = fopen($myFile, 'a') or die("can't open file"); $filename = 'temp.html'; $string = file_get_contents($filename); fwrite($fh,$string); fclose($fh); ?> So the question is is it possible? and if so how do I increment the record number? Thanks,
  4. Thanks for the solution and explanation. It now works perfectly. Thank you very much.
  5. Thanks for the reply, this is the entire r5include file: <img height=75 src='images/up.jpg' hidefocus='true' usemap='#record51' /> <map name='record51'> <area shape='rect' coords='0,0,75,75' href='add.html' target='_blank'> If I use either of the first two that I posted it changes the way i want it to. If I put them both on the same page separately it changes the whole thing to what I want. But the one where I put them in an array doesn't do anything.
  6. The first two work perfectly. In the third, I tried to put them together in an array and nothing happens. Can anyone see what I am doing wrong? Thanks <?php $ident = $_POST['ident']; ?> <?php $filename = 'r5include.html'; $string = file_get_contents($filename); $data = str_replace("add.html' target='_blank'","$ident.html' target='iframe2'","$string"); $handle = fopen($filename, "w+"); fwrite($handle,$data); fclose($handle); ?> <?php $ident = $_POST['ident']; ?> <?php $ident2 = ($ident . 2); $filename = 'r5include.html'; $string = file_get_contents($filename); $data = str_replace("'images/up.jpg'","'$ident/$ident2.jpg'","$string"); $handle = fopen($filename, "w+"); fwrite($handle,$data); fclose($handle); ?> <?php $ident = $_POST['ident']; ?> <?php $ident2 = ($ident . 2); $filename = 'r5include.html'; $string = file_get_contents($filename); $old = array("'images/up.jpg'","add.html' target='_blank'"); $new = array("'$ident/$ident2.jpg'","$ident.html' target='iframe2'"); $data = str_replace("$old","$new","$string"); $handle = fopen($filename, "w+"); fwrite($handle,$data); fclose($handle); ?>
  7. It works perfectly. Thank you very much.
  8. After days of searching I found this thread http://www.phpfreaks.com/forums/index.php?topic=236954.0 that helped me do what I was trying to do. I've gotten the code to create and rename my html document but I can't figure out how to use the preg_replace part. This is my template with the 3 variables I want to replace with values from a form. <html><head><link rel="stylesheet" type="text/css" href="style.css" /></head><body><?php include_once('content.php') ?></body><SCRIPT language="JavaScript" SRC="javascript.js"></SCRIPT><script type="text/javascript"> function nametitle(){ parent.iframe1.document.getElementById("div1").innerHTML = "VARIABLE1<br>VARIABLE2";parent.iframe1.document.getElementById("quotes").innerHTML = "VARIABLE3";} </script></html> I've spent hours reading and trying to understand how to make it work but it's a little over my head. Could someone help me with this? Thanks,
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.