Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PHP echo statement location within html

Posted on 2007-12-04
5
Medium Priority
?
2,375 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 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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 look for a specific file type in a local or remote server directory using PHP.

715 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