PDA

View Full Version : echo problem


moe122
03-02-2008, 03:45 PM
hi david,

you know when you have the echo thing in php it shows a message at the top of the window, how can i put it wherever i want?

davidj
03-02-2008, 06:55 PM
assign the string to a variable then place the variable and echo it where you want it in the page


<?php echo $variable; ?>

moe122
03-02-2008, 07:07 PM
bt its as an else if statement so elseif echo......

moe122
03-02-2008, 07:11 PM
ok i've changed the elseif 2 <?PHP if($submitted){
echo $error;
}?> and put it where i want so its within the html coding..........that ent going to cause me ne problems is it?

davidj
03-02-2008, 07:20 PM
its best to try and keep your logic seperate

above the HTML tag (inside the php)


if($submitted){

$error = "error1 text";

}else{

$error = "error2 text";

}



inside the html


<?php echo $error; ?>

moe122
03-02-2008, 07:32 PM
yh i did something similar but had the else if as jus if and put that with the html bt ur method seems logical so ive changed it now. cheers