Tuesday, 15 April 2014

How to move text output of php in html -


I have a php code block related to account login logout, etc. However, when I log in without a valid password, please enter a valid username / password "However, when the text appears, it is covered with my HTML scripts, I do not know I can transfer it or I need it to be converted into HTML scripts, please let me Anjitent Thanks to X

While this output

  & lt ;! D0CTYPE html & gt; & LT ; Html> gt; Top & gt; Shell & Gt; # liens {position: absolute; top: 15px; left: 1200px; z- index: 9;} & Lt; / style & gt; & Lt; / head & gt; & Lt; / html & gt; & ($ _ POST ['username'] ['Password']; $ password_hash = md5 ($ password); if (empty! ($ User name) & amp; empty ($ password)) user from $ {$ query = "SELECT` ID`" where user name = ''. Mysql_real_escape_string ($ username). '' And 'password` = "mysql_real_escape_string ($ password_hash) .." "; If ($ query_run = @ mysql_query ($ query)) {$ query_num_rows = mysql_num_rows ($ query_run); if ($ query_num_rows == 0) {echo 'invalid username / password!';} Else if ($ query_num_rows == 1) {$ user_id = mysql_result ($ query_run, 0, 'id'); $ _SESSION [ 'user_id'] = $ user_id; header ( 'location: index.php');}}} {echo "you username / Password must be entered! ';}}? & Gt; & lt; div id = "lion" & gt; form action = "& lt ;? Php echo $ current_file ;? & Gt; "method =" post "& gt; username: & lt; input type =" text "name =" username "& gt; password: & lt; input type =" password "name =" password "& Gt; & lt; input type = "submit" value = "sign in" & gt; & lt; / form & gt; & lt; / div & gt; this main page & lt;! D0CTYPE html & gt; LT; html & gt; & Lt; top & gt; & Lt; title & gt; Volunayr & lt; / title & gt; & Lt; meta charset = "UTF -8" & gt; & Lt; link rel = " Stylesheet "href =" stylex.css ">  & Lt; Div id = "nav" & gt; & Lt; Div id = "nav_wrapper" & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; Solitaire Leaderboard & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; Hour tracker & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; Non-profit & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; Contact us & lt; / A & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; View & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; Contact form & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; Suggestion form & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; Hour logs & lt; / A & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; Your hours & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; Ontario Regulations & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Li & gt; & Lt; / Li & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Body & gt; & Lt; / Html & gt;    

echo will output exactly where code is placed, so if your PHP script Your HTML is calling the echo before the output, the resonant string appears above html.

If you want to have a message within HTML, as you need, you should instead message the variable in one place, and then within your HTML, call Echo where you want to reveal the message. Want to

But as Andro said, without the actual code, it is difficult to give you a clear example.

  & lt ;? Php $ my_message = 'Please enter a valid username / password; ? & Gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div id = "error_message" & gt; & Lt ;? = $ My_message; ? & Gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

Something, super basic example with those lines.


No comments:

Post a Comment