Jump to content

[SOLVED] Weird Error in my opinion


whiteboikyle

Recommended Posts

Okay i have a form setup..

like so

<form action="process.php" method="POST">
  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="8%"><div align="left"><Font color="#FFFFFF" size="1" face="arial">Name:</font></div></td>
        <td width="92%"><div align="left"><Font face="arial" size="2" color="#FFFFFF"><b>
          <input type="hidden" name="txt_author" value="<?php echo($filterUsername); ?>">
	  <input type="hidden" name="user" value"<?php echo($Username); ?>">
        <?php echo($filterUsername); ?></b></font></div></td>
      </tr>
      <tr>
        <td colspan="2" ><Font face="arial" size="1">Text:<br />
            <textarea name="txt_comment" cols="60" rows="10" style="width:490px"></textarea>
        </font></td>
      </tr>
  </table>
<Font face="arial" size="1">
<center>
	<input type="hidden" name="addcomment" value="1">
  <input type="submit" value="Submit">
  <input type="reset" value="Reset">
</center>
</font>
</form>

 

These 2 variables are defined back in front of the code
          <input type="hidden" name="txt_author" value="<?php echo($filterUsername); ?>">
	  <input type="hidden" name="user" value"<?php echo($Username); ?>">

 

if i type die($Username); on the profile.php it will print it the name..

Well on process.php i have this

 

<?

class Process
{
   /* Class constructor */
   function Process(){
      global $session;

  /* User Submitted News Page Form */
  if(isset($_POST['addcomment'])){
  	 $this->procAddComment();
  }
       else{
          header("Location: index.php");
       }
   }

   /**
    * procLogin - Processes the user submitted login form, if errors
    * are found, the user is redirected to correct the information,
    * if not, the user is effectively logged in to the system.
    */
   
function procAddComment(){
   	global $session, $form;
//$retval = $session->news($_POST['txt_subject'], $_POST['txt_comment'], $_POST['txt_comment']);
$filterUsername = $_POST["txt_author"];
$len = strlen($filterUsername);
$Username = $_POST['user'];
die($Username);	

// Only Write To Database If There's A Name
if ($len > 0)
{
	$comment = $_POST["txt_comment"];
	$date = time();
	$query = "INSERT INTO news (ID, Name, Text, From, Date) VALUES (NULL, '$name', '$subject', '$comment', '$date')";
	mysql_query($query, @mysql_connect(DB_SERVER, DB_USER, DB_PASS)) or die(mysql_error());
	include("header2.inc");
	echo("<center><font size='4'><font color='red'>Post has been submitted! Will redirect in 2 seconds</center></font>");
	echo("<META HTTP-EQUIV='refresh' CONTENT='2;news.php'>");
	//header("location:news.php");
	include("footer.inc");
}
}

};

 

but the die($username); results in it being blank....(no content) help?

Link to comment
https://forums.phpfreaks.com/topic/101554-solved-weird-error-in-my-opinion/
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.