Need help displaying php echo in div.

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
wurdup
Forum Commoner
Posts: 39
Joined: Thu Apr 01, 2010 11:36 am

Need help displaying php echo in div.

Post by wurdup »

Is it possible to display an echo in a div from an if statement before the html code?

Basically I'm using server sockets and need to display the result before and after sending in a div box. You enter the string in an input box which sends to itself it then should display a message in the div saying sending to server, then reads the server message and displays that in the same div box. Is it ok to put post code below in a div in the body?

Code: Select all


if(isset($_POST['submit'])) { 

echo "sending" 

//socket code

echo $serverResult;
}

User avatar
flying_circus
Forum Regular
Posts: 732
Joined: Wed Mar 05, 2008 10:23 pm
Location: Sunriver, OR

Re: Need help displaying php echo in div.

Post by flying_circus »

The best solution would probably be to use AJAX.
wurdup
Forum Commoner
Posts: 39
Joined: Thu Apr 01, 2010 11:36 am

Re: Need help displaying php echo in div.

Post by wurdup »

ok thanks will look into it. I've tested putting the if(isset($_post) in the body and it works. Are there any security implications doing this?
Post Reply