-
beginner error: forms not appearing
new to php, cant get the forms next to a: and b: to appear in the html portion of my code:
[CODE]
2 <?php
3 if (isset($_POST['submit']))
4 {
5 $a = $_POST['a'];
6 $b = $_POST['b'];
7 if ($a == $b) {
8 echo "a is equal to b.";
9 }
10 }
11
12 ?>
13 <HTML>
14 <BODY>
15 <center><br /><br />
16 <form method="post" action=" <?PHP echo $_SERVER['PHP_SELF']; ?> " >
17 a: <insert type="text" name="a"> <br />
18 b: <insert type="text" name="b"> <br />
19 <input type="submit" name"submit">
20 </form>
21 </BODY>
22 </HTML>
[CODE]
-
-
PHP is added into existing HTML pages and does not change anything except that which is inside the <?php ?> blocks. In other words, this is not a problem with PHP. In fact, your PHP looks like it should, probably, work.
<insert> is not an html element. You want <input>.
Also, that code is very messy and invalid. For example, you never close your <center> tag, and that element is not the modern way to center elements on the page anyway. And overusing <br> is not the best way to space things.
I don't mean for all of this to sound too harsh, but start with the basics and build on a strong foundation or you will have a lot more problems trying to do more complex things.
Daniel -
Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks