Solved

PHP echo statement location within html

Posted on 2007-12-04
5
2,348 Views
Last Modified: 2013-12-13
so heres my code:

php
$link="http://www.website.com";
if(!isset($_POST['agree']) && isset($_POST["is_submit"]) && $_POST["is_submit"]==1)
{
echo "Please agree to the terms, it is all I am asking!";
}
else if(isset($_POST['agree']) && $_POST['agree']=="ON")
{
header("location:$link");
}
?>

<html>

<head>
<title>site</title>
</head>

<body>

Welcome to my site here is something to get started.
<form action="agree.php" method=POST>

<textarea name="textfield" rows="5" cols="25" wrap="virtual" readonly onFocus="this.blur();">OK so here are my terms and conditions.</textarea>

      <p><input type="checkbox" name="agree" value="ON">I Agree
      <input type=submit value="Login" style="float: left">
      <input type="hidden" name="is_submit" value="1">
      </p>
      &nbsp;</form>

</body>

</html>


how do position echo statements: i want my echo statement on line 5 (Please agree to the terms, it is all I am asking! Welcome to my site here is something to get started.)
to appear after the login button to the right same line....

and what is a good source for placing or positioning php code within html designs?
0
Comment
Question by:bcmeyer1983
  • 2
  • 2
5 Comments
 
LVL 2

Author Comment

by:bcmeyer1983
Comment Utility
apologies omit this phrase in the question above:
Welcome to my site here is something to get started.)
to appear after the login button to the right same line....
0
 
LVL 21

Accepted Solution

by:
nizsmo earned 500 total points
Comment Utility
Something like this?
YOu can place the echo anywhere you like :)
<?php

$link="http://www.website.com";

if(!isset($_POST['agree']) && isset($_POST["is_submit"]) && $_POST["is_submit"]==1)

{

$error_text = "Please agree to the terms, it is all I am asking!";

}

else if(isset($_POST['agree']) && $_POST['agree']=="ON")

{

header("location:$link");

}

?>
 

<html>
 

<head>

<title>site</title>

</head>
 

<body>
 

Welcome to my site here is something to get started.

<form action="agree.php" method=POST>
 

<textarea name="textfield" rows="5" cols="25" wrap="virtual" readonly onFocus="this.blur();">OK so here are my terms and conditions.</textarea>
 

      <p><input type="checkbox" name="agree" value="ON">I Agree

      <input type=submit value="Login" style="float: left"><?php echo $error_text; ?>

      <input type="hidden" name="is_submit" value="1">

      </p>

      &nbsp;</form>
 

</body>
 

</html>

Open in new window

0
 
LVL 28

Expert Comment

by:gamebits
Comment Utility
You can go in and out of php as you wish, wherever you want an echo statement to appear in an html document just open a php tag do your php script close the php tag.

ex.
some html
Bla
Bla
Bla
BlaBlaBlaBlaBla <?php echo "some php"; ?> back to html BlaBlaBlaBlaBla
BlaBlaBla
Bla
0
 
LVL 2

Author Closing Comment

by:bcmeyer1983
Comment Utility
wow, that simple. thanks for filling me in
0
 
LVL 21

Expert Comment

by:nizsmo
Comment Utility
Glad to help :)
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now