outputtiing text help still needed

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kebo
Forum Newbie
Posts: 9
Joined: Mon Aug 28, 2006 9:16 am

outputtiing text help still needed

Post by kebo »

How do I make php output "<td></td>" ?

When I use

Code: Select all

echo "<td></td>";
I guess it treated as an html string and I get no output.

thanks, second day learning php
kevin
Last edited by kebo on Tue Aug 29, 2006 2:56 pm, edited 1 time in total.
User avatar
darodesign
Forum Newbie
Posts: 19
Joined: Mon Aug 28, 2006 8:58 am
Location: Berlin
Contact:

Post by darodesign »

What do you mean with no output ? You can't see anything 'cause the table data fields are empty! Looked in the Website Source ? ( At the viewing with your Browser )
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

You mean that you want to see on the screen with your browser:

<td></td>

Is that what you mean?

Edit: If that's what you want, then use this code:

Code: Select all

echo htmlspecialchars('<td></td>');
Last edited by Oren on Tue Aug 29, 2006 10:53 am, edited 1 time in total.
kebo
Forum Newbie
Posts: 9
Joined: Mon Aug 28, 2006 9:16 am

Post by kebo »

Oren wrote:You mean that you want to see on the screen with your browser:

<td></td>

Is that what you mean?
yes exactly
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

I edited my previous post, take a look :wink:
kebo
Forum Newbie
Posts: 9
Joined: Mon Aug 28, 2006 9:16 am

Post by kebo »

cool thanks oren...

^5

kevin
kebo
Forum Newbie
Posts: 9
Joined: Mon Aug 28, 2006 9:16 am

Post by kebo »

so that works to directect the output to the browser, but now I would like to direct the output to a file. So when I use

Code: Select all

$fo = fopen($fname, "w");
echo fwrite($fo ,"<td></td> ");
the file contains <td></td>, but if I try

Code: Select all

$fo = fopen($fname, "w");
echo fwrite($fo ,"<HTML> ");
the file is empty, and when I use

Code: Select all

$fo = fopen($fname, "w");
echo htmlspecialchars('<HTML>');
the < turns into < and the > turns into >.
Can anyone explain this in a brief nutshell or explain how to write <HTML> to a file?
thanks
kevin
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

Well pal, I could tell you what your mistakes are, but this isn't really going to help. You need to take a good book and start reading.
You know the old saying about the man and the fish...
kebo
Forum Newbie
Posts: 9
Joined: Mon Aug 28, 2006 9:16 am

Post by kebo »

Oren wrote:Well pal, I could tell you what your mistakes are, but this isn't really going to help. You need to take a good book and start reading.
You know the old saying about the man and the fish...
Well i certainly would agree about the fish part, but in the real world, if someone works for me and spends 2 days in a book trying to find information they can get in 2 minutes by asking....i'd fire them
MaxInfinity
Forum Newbie
Posts: 4
Joined: Thu Aug 24, 2006 5:14 am

Post by MaxInfinity »

thats the best answer to a remark I've ever heard.

The whole point of forums is to help yourself and other people and if people don't want to help and show off their coding skills, they should not be on a forum.

None of that was directed at oren either, I talking in general. The worst advice is use the search button, on a good forum this will bring up 10000 posts 90% of which, have nothing to do with what you searched for. Yes I know its annoying to be asked the same question over and over again, but until a search button works properly, surely its easier and quicker to type a link to the post with the correct info, than to type try using the search button.

On the other side of the coin, the people asking for help should at least try to write the code they need and if they get stuck, post the code for someone to look at, and point you in the write direction. My php mysql coding skills are dire to say the least, but I can still manage a very decent page with a little research and the odd question here and there.

JMHO
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

well he should at least read the manual page for htmlentities: http://fr3.php.net/manual/en/function.h ... lchars.php

Once you read that page... the whole thing (not including user comments of course) and you still are confused... I'll help you.
User avatar
Oren
DevNet Resident
Posts: 1640
Joined: Fri Apr 07, 2006 5:13 am
Location: Israel

Post by Oren »

I don't have much to say as I made my point very well (I believe) with the fish saying.

Anyway, try this instead:

Code: Select all

fwrite($fp ,'<td></td>');
(Without the 'echo')

If you are using PHP 5, just use this:

Code: Select all

file_put_contents($file_name, $data);
Post Reply