Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

for problem 1

Status
Not open for further replies.

egmweb

Programmer
Mar 19, 2004
147
EU
Hello Guys,

I'm having problems writting a script with for sentence and it doesnt shows me nothing. this is my code

for ($i=0; $i<2; $i++){
echo '<menu><gallery name="'.$i.'">';
}

I'm trying to print an xml code.

Please does anybody help me with this?

Thanks you.
 
In my browser, I see nothing running that script. But when I do "View source" on the page, my editor shows:

<menu><gallery name="0"><menu><gallery name="1">

Have you done a "view source"?



Want the best answers? Ask the best questions! TANSTAAFL!
 
Yes, I see the the xml code, but we need to print that, how can we do that? like a normal string in php?
 
are you trying to generate an xml file using this?

At the moment your code would show half an xml tag in the source of a page. i.e.

<menu><gallery name="0"><menu><gallery name="1">

'mi casa es su casa'
]-=tty0=-[
 
i think you want the [tt]htmlspecialchars[/tt] function.

try

Code:
for ($i=0; $i<2; $i++){
  echo htmlspecialchars('<menu><gallery name="'.$i.'">');
}



*cLFlaVA
----------------------------
[tt]( <P> <B>)[sup]13[/sup] * (<P> <.</B>)[/tt]

[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
hi you need to change the code to:

for ($i=0; $i<2; $i++){
echo '&lt;menu&gt;&lt;gallery name="'.$i.'"&gt;';
}

'mi casa es su casa'
]-=tty0=-[
 
* to clflava, Im not thinking straight today :)

'mi casa es su casa'
]-=tty0=-[
 
Thanks you very much guys, it works with the htmlspecialchars function... best regards to all of you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top