Warptweet Posted January 13, 2007 Share Posted January 13, 2007 I have this code...[code]<A HREF="javascript:void(0)"ONCLICK="window.open('http://www.google.com','miniwin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=500,height=300')">Open A Window</a>[/code]How can I write that code to http://www.warptweet.com/2116121514119/$randnum?By the way, $randnum is the file that was uploaded.I use fopen with the w (write)I think it gives me an error because that javascript has a "'s in it, how can I resolve the "'s? Link to comment https://forums.phpfreaks.com/topic/34061-write-this-code-onto-a-file/ Share on other sites More sharing options...
scotmcc Posted January 13, 2007 Share Posted January 13, 2007 This works for me, notice I put a '\' in front of each ".[code]<?php// Escape the offending character :)$text = "<A HREF=\"javascript:void(0)\"ONCLICK=\"window.open('http://www.google.com','miniwin','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=500,height=300')\">Open A Window</a>"; $file = "myfile.html"; if (!$my_file = fopen($file,"a")) { echo "Unable to open $file"; } if (!fwrite($my_file, $text)) { echo "Unable to write to $file"; } echo "Text entered into $file"; fclose($my_file); ?> [/code] Link to comment https://forums.phpfreaks.com/topic/34061-write-this-code-onto-a-file/#findComment-160141 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.