Jump to content

problem with $_POST


gervacio_stacey

Recommended Posts

- In the last part, I tried to echo the value of HOME which is a textbox. But I can't echo anything. Please help me..

well here's my code:

 

 

<?php
session_start();

include("connection.php");

$username=$_SESSION['user'];

$sql="SELECT * FROM engineering WHERE username='$username'";
$sql_result=mysql_query($sql);
$numrows=mysql_num_rows($sql_result);

if($numrows==1)
{
$stud=1;
$row=mysql_fetch_array($sql_result);
$first_name=$row['FIRSTNAME'];
$last_name=$row['LASTNAME'];
$id=$row['IDNUMBER'];
}
else
{
$sql="SELECT * FROM faculty_admin WHERE username='$username'";
$sql_result=mysql_query($sql) or die ('Connection to database lost');
$numrows=mysql_num_rows($sql_result);

if($numrows==0)
{
$error_message='Invalid username';
}
else
{
$admin=1;
$row=mysql_fetch_array($sql_result);
$first_name=$row['FIRSTNAME'];
$last_name=$row['LASTNAME'];
$id=$row['FACULTY_NUMBER'];
$name=$row['ADMIN_NAME'];
}
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "(URL address blocked: See forum rules)">
<html xmlns="(URL address blocked: See forum rules)">
<head>
<title>HOMEPAGE</title>
<style type="text/css">
<!--
.style10 { font-size: 12px;
font-family: Geneva, Arial, Helvetica, sans-serif;
font-weight: bold;
}
.style11 {font-size: 18px}
.style12 {font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; }
.style14 {font-family: Geneva, Arial, Helvetica, sans-serif;
font-weight: bold;
}
.style18 {font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; font-size: 36px; }
.style20 {
font-size: 18px;
color: #FF0000;
font-family: Arial, Helvetica, sans-serif;
}
-->
</style>
</head>

<body>
<p> </p>
<table width="873" border="0" align="center">
<tr>
<td colspan="4"><div align="center" class="style18">
<p>UNIVERSITY OF SANTO TOMAS</p></div></td>
<td width="98"><img src="ust.jpg" alt="UST LOGO" width="98" height="114"></td>
</tr>

<tr>
<td colspan="5">
<form method=POST action="logout.php">
<p align="right">
<input type="submit" name="Submit" value="LOG-OUT"></p>
</form>
<p align="center" class="style10 style11 style14">WELCOME
<? if($stud==1)
echo $first_name;
else
{
echo $name;
}?>!</p>
<p> </p>
</td>
</tr>

<tr bgcolor="#FFFF99">
<td width="174" bgcolor="#FFCC00"> <a href="hometest.php"> <div align="center" class="style12"> HOME </div> </a> </td>
<td width="261"> <a href="clearancetest.php"> <div align="center" class="style12">CLEARANCE</div> </a> </td>
<!-- kelangan ng if condition dito sa next line. kapag irreg, punta sa irregular.php kapag regular naman, regular.php dko alm kung pano. hehe. -->
<td width="233" bgcolor="#FFFF99"> <div align="center" class="style12">PRE-SECTIONING</div> </td>
<td colspan="2" bgcolor="#FFFF99"> <a href="profiletest.php"> <div align="center" class="style12">PROFILE</div> </a> </td>
</tr>
</table>

<p> </p>

<div align="center"><span class="style20">ANNOUNCEMENTS:</span></div>
<BR/><BR/>
<?
$now="SELECT stuffs from stuffs where stuff_no=1";
$sql_result=mysql_query($now) or die ('Connection to database lost');
$row=mysql_fetch_array($sql_result);
$now=$row['stuffs'];
echo $now;
?>

<BR/><BR/><BR/>
<form method="POST" action="hometest.php">
Input Announcement: <BR/>
<input NAME="HOME" type="text" size="150" value="TEXT">
<BR/><BR/>
<input name="Submit" type="Submit" value="Save and View">
</form>

<?
echo $_POST['HOME']; // [color=red]HERE'S MY ECHO <-- DOESN'T GET THE VALUE OF HOME[/color]

?>
<p align="center"> </p>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/124714-problem-with-_post/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.