PHP and Javascript


Posted on 16th Feb 2014 07:03 pm by admin

Hi Guys,

Im trying to load the contents of an html file into a text area for editing, this is the code I have so far but it doesnt seem to be working. I think it's because some of the $line have "" etc in them which is messing it up, any help/advice is greatly appreciated. I've also commented out some things i've tried and didnt work!
$handle = fopen("".$tmpfile, 'r');
$lines = file($tmpfile);
echo '<form method="post" name="box" action="">';
echo '<textarea name="codebox"></textarea>';
echo '</form>';
foreach ($lines as $line_num => $line)
{
//$line = htmlentities($line,ENT_QUOTES);
//echo $line;
print("<script language = 'javascript'>alert(".''.$line.");</script>");

//Typical Line <html xmlns="http://www.w3.org/1999/xhtml">
// echo "<script language = 'javascript'>var newtext = "."'".$line."'"."; document.box.codebox.value += 'newtext'; </script>";
// echo "". htmlspecialchars($line) . "<br />n";
}
fclose($handle);

No comments posted yet

Your Answer:

Login to answer
312 Like 51 Dislike
Previous forums Next forums
Other forums

PECL uploadprogress for php5.2
Hey, I just installed PHP5 via .htaccess on my 1and1 Shared Hosting Account.

How would I exac

b+ tree
Hi
can every body help me about b+ tree ?(insert & delete)

How to create a static html menu from a database
Hi,

I have built a small cms which allows me to create simple html pages and then upload them

is this the proper use of mysql_real_escape_string() to prevent sql injections?
i was wondering is this the proper use of mysql_real_escape_string() to prevent sql injections? any

Async WSAConnect failed on XP with error code = 2 ("File not found")
Hi all,

I have very strange bug, please help me if you can.

It is reproduced o

SCO Unix
I know this might not be the place to ask, but, can anyone tell me if SCO Unix comes with PHP built

Save data in input fields when they press "BACK BUTTON"
Hi, this is html form: And let's say they get a error "Please enter ur title must be more then

Varible in trigger - refering to correct schema
Hello

Im having some issues with my trigger.
What I want to do is call opon a differ

CHMOD script
Hi,

I need a script to read all files in a folder and set to 777.

Can anyone help out

small inaccuracies
I have this code to convert fractional base 10 into base 2:

while($num > 0)

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash