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

constructor ?
i have written this program and made 3 constructors in the class and i want to call them in the main

extending tidy
I have problem with type-hinting and extending tidy. This code creates error:
Code: class cMyTidy

SELECT * FROM users WHERE Users are not in Blocked
How do I select all users from users table where there users_id is not stored in the block table

PHP friend keyword equivalent
is there a PHP equivalent for the C++ friend keyword?

Two warning messages
Quote<b>Warning</b>: mysql_real_escape_string() expects parameter 1 to

Problem with creating FI documents
Hi, Experts!

when i create Fi doc. with standart transaction, i ve been had such problem

str_replace help
Hey there,

I'm a PHP newb, I'm having troubles with the str_replace function. I want to clean

Why is this query failing?
Why is this not working?
$query = "SELECT * FROM `users` WHERE `userid` = " . $USERID

Multiple Do / While Statements?
I'm still very new to PHP, and running in to a problem when trying to execute a do/while loop inside

Limiting uploaded file type
Hi. First post here
I am working on a simple upload script, and I need it to limit the allowed f

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