Solved

PHP echo statement location within html

Posted on 2007-12-04
5
2,370 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 2

Author Comment

by:bcmeyer1983
ID: 20408306
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
ID: 20408307
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
ID: 20408316
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
ID: 31412761
wow, that simple. thanks for filling me in
0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20408425
Glad to help :)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

626 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