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

Using loop to count number of entries
I'm writing a program that must ask user to type in numbers. After each entry, the program has to re

Production Order Enterprise Service to Manufacturing Exctn Sys (MES) ???
Hello Experts,

In our current landscape SAP ECC 5.0 is integrated to MES system via PI 7.

upload image name with extension using php
hi frds..

<input id="file1" type="file" name="file[]" &a

Which PHP-Editor do you think is the best?
Hi everyone,
Myself Brian Anderson. For the last 2 years i have been working a

Help with translating C code into assembler code
Hi im doing a project that moves a robot around a maze avoiding walls and need some help with conver

How could I combine these arrays??
Hello.. I'm trying to figure out a way to combine these first two arrays to get the last array..

registration form
first time posting. did some searches but didnt find exactly what i am looking for. dont flame cause

Probably Easy, Need help with Check Boxes in PHP Code
hello,

Thanks for looking this over and helping me out. My problem is I have a online store l

Syntax error
hi im having a little trobble with this script
-------------------------------------------------

* Gridview and Detailsview in UpdatePanel, insert mode problem
I have a GridView and DetailsView working together. When a record from Gridview is selected, Detail

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