473,407 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

HTML code in eval

Hi

I'm currently trying to put some HTML code into a variable and to use
it later.
Any ideas, why TEST1 in the following example displays a link, while
TEST2 only displays a text?

Any help appreciated.

<html>
<head>
</head>

<body>

<!-- TEST1 -->
<a href=\"www.test.com\">this is test1</a>

<br><br>

<!-- TEST2 -->
<?
$teststr="?><a href=\"www.test.com\">this is test2</a><?php";
eval($teststr);
?>

</body>
</html>

Mar 9 '06 #1
4 2253
su******@europe.com wrote in news:1141939601.672057.138520
@j33g2000cwa.googlegroups.com:
Hi

I'm currently trying to put some HTML code into a variable and to use
it later.
Any ideas, why TEST1 in the following example displays a link, while
TEST2 only displays a text?


your HTML code is totally screwed up. whats with the \" stuff outside of
PHP?!??

me thinks you are very, very confused.
Mar 9 '06 #2
I'm not sure I understand why you're trying to use eval in this
situation. Wouldn't this give you the result you're after?

$teststr = '<a href="www.test.com">This is test 2</a>';
echo $teststr;

Scott

su******@europe.com wrote:
Hi

I'm currently trying to put some HTML code into a variable and to use
it later.
Any ideas, why TEST1 in the following example displays a link, while
TEST2 only displays a text?

Any help appreciated.

<html>
<head>
</head>

<body>

<!-- TEST1 -->
<a href=\"www.test.com\">this is test1</a>

<br><br>

<!-- TEST2 -->
<?
$teststr="?><a href=\"www.test.com\">this is test2</a><?php";
eval($teststr);
?>

</body>
</html>

Mar 9 '06 #3
eval(); is evil. You should use it only in extreme situations.

You can also try here document syntax.

http://de.php.net/echo

su******@europe.com wrote:
Hi

I'm currently trying to put some HTML code into a variable and to use
it later.
Any ideas, why TEST1 in the following example displays a link, while
TEST2 only displays a text?

Any help appreciated.

<html>
<head>
</head>

<body>

<!-- TEST1 -->
<a href=\"www.test.com\">this is test1</a>

<br><br>

<!-- TEST2 -->
<?
$teststr="?><a href=\"www.test.com\">this is test2</a><?php";
eval($teststr);
?>

</body>
</html>


Mar 10 '06 #4
d
"Johannes Matjeschk" <Jo****************@googlemail.com> wrote in message
news:11*********************@j33g2000cwa.googlegro ups.com...
eval(); is evil. You should use it only in extreme situations.

You can also try here document syntax.

http://de.php.net/echo
They should just rename it to evil() and get it over with. "If eval() is
ever the answer, you've screwed up the question" :-P
su******@europe.com wrote:
Hi

I'm currently trying to put some HTML code into a variable and to use
it later.
Any ideas, why TEST1 in the following example displays a link, while
TEST2 only displays a text?

Any help appreciated.

<html>
<head>
</head>

<body>

<!-- TEST1 -->
<a href=\"www.test.com\">this is test1</a>

<br><br>

<!-- TEST2 -->
<?
$teststr="?><a href=\"www.test.com\">this is test2</a><?php";
eval($teststr);
?>

</body>
</html>

Mar 10 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
4
by: comcast news | last post by:
at least i think it this is the problem am trying to fix a webpage/javascript that i didn't write www.deltaneutral.com when invoked or any new page from the menu, get the error msg line 2...
6
by: Paolo Pignatelli | last post by:
I have an aspx code behind page that goes something like this in the HTML view: <asp:HyperLink id=HyperLink1 runat="server" NavigateUrl='<%#"mailto:" &amp;...
8
by: Randall Parker | last post by:
I want to generate an HTML tag that will look like: <a href="EquipmentServiceCreate.aspx?serial=X01">Create New Service For X01</a> or on a different instance where the user would be viewing...
26
by: onearth | last post by:
Hello I already managed to add a dynamic DetailView under a row of Gridview if a user presses the row with the mouse... Is it possible to add under it a table(or even better load a simple...
2
by: Joe | last post by:
Hello All: I am writing to ask for your opinions. I have a colleague who combines his code with the markup used to display the code (reckoning back to classic ASP). Here's an example of a...
10
by: pak.andrei | last post by:
Here is my script: from mechanize import * from BeautifulSoup import * import StringIO b = Browser() f = b.open("http://www.translate.ru/text.asp?lang=ru") b.select_form(nr=0) b = "hello...
13
by: mowsen | last post by:
Hello Group, i'm using a little "ajax" loader script to dynamically load files into different "div" tags on my main site. the code for this part looks like: function loader() { var args =...
4
by: Jeff | last post by:
I've been working on porting some perl CMS code to PHP. What I would do in perl is search through a template for instruction and replace those instructions with specific bits for that particular...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.