index.php

<div style="margin: 123px 0 0 310px; position: absolute; z-index: 3;">
<form action="login_portal.php" method="POST">
<input type="text" class="form" name="username"><br>
<input type="password" class="form2" name="password">
<div style="margin: 15px 0 0 330px; position: absolute;">
<input type="hidden" name="submit" />
<input type="image" src="images/login.jpg" alt="submit" width="200px"></div>
</div>

login_portal.php

echo "test";

if (@$_POST['submit']) { 

echo "enter";

I wonder why I only see the word "test", and not "enter"? I thought I suppose to see the word "enter" also.

login_portal, is currently html, <?php ?> missing, { I thought I was funny
then;
close the brace if (@$_POST['submit']) { echo "enter";}
@ switches off error reporting for the current command, not a good thing till production ready

<?php 
echo "test";
if ($_POST['submit']) { echo "enter"; } 
?>

a code highlighting editor, notepad replacement, like [not ad] notepad++ notepad2 [/not ad] will show incomplete braces, missing closures, while you type and make debugging a bit easier

  1. not affilited in any way with a notepad replacement
  2. no } after "funny"
  3. strange what makes some people laugh

Your hidden submit does not have a value, so by default that is an empty string, which evaluates to false.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.