PHP code in html form

I have an html login form built with a wysiwyg program. Need to insert some php to validate the user when the submit button is pressed. No matter where I put the php when I publish the page, it comes up empty. No background color, no title, no form.

Here’s the html:

<!-- Header Code -->

<style type="text/css">
	.OBJ-1 { margin:0;background:transparent url('wpimages/wpe364851b.png') no-repeat left top; }
	.P-1 { text-align:center;line-height:1px;font-family:"Tahoma", sans-serif;font-style:normal;font-weight:700;color:#000000;background-color:transparent;font-variant:normal;font-size:18.0px;vertical-align:0; }
	.C-1 { line-height:22.00px;font-family:"Tahoma", sans-serif;font-style:normal;font-weight:700;color:#000000;background-color:transparent;text-decoration:none;font-variant:normal;font-size:18.0px;vertical-align:0; }
	.C-2 { line-height:19.00px;font-family:"Tahoma", sans-serif;font-style:normal;font-weight:normal;color:#000000;background-color:transparent;text-decoration:none;font-variant:normal;font-size:16.0px;vertical-align:0; }
	.OBJ-2 { border:1px solid #000000;border-radius:2px / 2px;background:#ffffff;font-family:Tahoma;text-align:left;font-size:16px;color:#000000; }
	.OBJ-3 { border:none;border-radius:1px / 1px;background:#626262;font-family:Georgia;text-align:center;font-size:16px;color:#ffffff; }
</style>
<script type="text/javascript" src="wpscripts/jquery.js"></script><script type="text/javascript" src="wpscripts/jquery.validate.min.js"></script>
<!--Header code for Form form_14 -->
<!--Header code for Text Frame - NCS Login txt_38 -->
<!--Header code for Text Frame - Callsign txt_39 -->
<!--Header code for Form Edit Box edit_20 -->
<!--Header code for Text Frame - Password txt_40 -->
<!--Header code for Form Edit Box edit_21 -->
<!--Header code for Form Button butn_13 -->



<!-- Form form_14 -->

<!--Preamble for Form form_14-->
<form name="ncs_login" id="form_14" action="http://www.serifwebresources.com/form.php?uid=" accept-charset="UTF-8" method="post" target="_parent" enctype="multipart/form-data" class="OBJ-1" __AddCode="here" style="position:absolute;left:424px;top:316px;width:335px;height:280px;/*Add Style*/">
	<!--Preamble for Text Frame - NCS Login txt_38-->
	<div __AddCode="here" style="position:absolute;left:30px;top:30px;width:275px;height:22px;overflow:hidden;/*Add Style*/">
		<p class="Body P-1"><span class="C-1">NCS Login</span></p>
	</div>
	<!--Postamble for Text Frame - NCS Login txt_38-->
	<label for="edit_20">
		<!--Preamble for Text Frame - Callsign txt_39-->
		<div __AddCode="here" style="position:absolute;left:30px;top:82px;width:273px;height:19px;overflow:hidden;/*Add Style*/">
			<p class="Body"><span class="C-2">Callsign</span></p>
		</div>
		<!--Postamble for Text Frame - Callsign txt_39-->
	</label>
	

	<!-- Form Edit Box edit_20 -->

	<!--Preamble for Form Edit Box edit_20-->
	<input id="edit_20" name="Callsign" class="OBJ-2" maxlength="32" __AddCode="here" style="position:absolute;left:30px;top:101px;width:273px;height:22px;/*Add Style*/">
	<!--Postamble for Form Edit Box edit_20-->
	<label for="edit_21">
		<!--Preamble for Text Frame - Password txt_40-->
		<div __AddCode="here" style="position:absolute;left:30px;top:155px;width:273px;height:19px;overflow:hidden;/*Add Style*/">
			<p class="Body"><span class="C-2">Password</span></p>
		</div>
		<!--Postamble for Text Frame - Password txt_40-->
	</label>
	

	<!-- Form Edit Box edit_21 -->

	<!--Preamble for Form Edit Box edit_21-->
	<input id="edit_21" name="Password" class="OBJ-2" maxlength="32" type="password" __AddCode="here" style="position:absolute;left:30px;top:174px;width:273px;height:22px;/*Add Style*/">
	<!--Postamble for Form Edit Box edit_21-->
	

	<!-- Form Button butn_13 -->

	<!--Preamble for Form Button butn_13-->
	<input name="Submit" class="OBJ-3" type="submit" value="Submit" __AddCode = "here" style="position:absolute;left:30px;top:228px;width:275px;height:22px;/*Add Style*/">
	<!--Postamble for Form Button butn_13-->

</form>

<!--Postamble for Form form_14-->

Any suggestions are welcome!

It must be my validation code. When I put in phpinfo() instead, it works fine.
Here is the php validation code:
[php]

<?php $_SESSION('Callsign') = $_POST('Callsign'); $_SESSION('Password') = $_POST('Password'); include('../include/conn_mysqli.inc.php'); $conn = dbConnect(); $sql = 'SELECT ncs FROM profile where callsign = ' $_SESSION('Callsign'); $ncs = mysql_query($sql) or die(mysql_error()); if($ncs == 'YES') { $sql = 'SELECT ncs_password FROM maintenance'; $pwd = mysql_query($sql) or die(mysql_error()); if ($pwd == $_SESSION('Password')) { _$SESSION('NCS') = 'YES'; // for use on index page header('Location: http://www.brothersnetlogger.net/index.html'); } else { echo('Sorry, NCS login failed'); } } else { echo('Sorry, NCS login failed'); } ?>

[/php]

Anyone see any problems? I did put
[php]

<?php session_start(); ?>

After the DOCTYPE in the page html.

Thanks for any help!
[/php]

There are many issues with this code…
Variable like $_SESSION and $_POST use square brackets, not round;
[php]
// INCORRECT
$_POST(‘name’)
// CORRECT
$_POST[‘name’]
[/php]
have a read of this and above all, stop using mysql and use mysqli or pdo instead.

Hope that helps,
Red :wink:

Thanks Red. You have helped me again. I’m really embarrassed. I really have been coding in several languages for about 20 years. And made good money at it too. What a newbie mistake. Maybe TOO many languages. Or maybe it’s just old age, 70 now.
Yes, mysqli, will do. Thanks again.

Regards,
k4elo

You’re very welcome :slight_smile:
and no need to be embarrassed, we all make mistakes sometimes. I know when i’ve been writing Python for an extended period my PHP skills wane and i have to spend a day or two getting back up to speed.

Take care,
Red :wink:

Sponsor our Newsletter | Privacy Policy | Terms of Service