Page 1 of 1

Need help displaying php echo in div.

Posted: Wed Oct 20, 2010 11:05 am
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;
}


Re: Need help displaying php echo in div.

Posted: Wed Oct 20, 2010 12:26 pm
by flying_circus
The best solution would probably be to use AJAX.

Re: Need help displaying php echo in div.

Posted: Wed Oct 20, 2010 12:55 pm
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?