PDA

View Full Version : How can you put......


drunkmafia
07-01-2011, 04:50 PM
Ok, what I want to know, is how do you put html code into a php block such as:


<?
else{
echo="<meta http-equiv="Refresh" content="5; url=http:login.php">"
}
?>
I know you have to do something like that but I always forget because it is not everyday you need to code in html, into a php block.

Also if you want to know why it says else, is because this is a code to send you to a login page if you are not logged in, here is the code that checks:

<?
if($session->logged_in){
?>

Then everything in the body and the else code comes in to redirect the person who is not logged in and then the close bracket to end the code. So that is why. I think I covered everything you need to know about the code but please help me.

Thank you

domedia
07-01-2011, 05:08 PM
Ok, what I want to know, is how do you put html code into a php block such as:


<?
else{
echo="<meta http-equiv="Refresh" content="5; url=http:login.php">"
}
?>
I know you have to do something like that but I always forget because it is not everyday you need to code in html, into a php block.



Just like that. Do you see that there is HTML in there already?

drunkmafia
07-01-2011, 05:09 PM
I know there is HTML in there but it comes up as an error.
http://snipxcrew.vacau.com/error.png

domedia
07-01-2011, 05:40 PM
You need to escape the double quotes.

<?
else{
echo="<meta http-equiv=\"Refresh\" content=\"5; url=http:login.php\">"
}
?>

drunkmafia
07-01-2011, 06:38 PM
Oh Ive fixed it by changing it to a php redirect code: header etc