whiteboikyle Posted April 17, 2008 Share Posted April 17, 2008 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? Quote Link to comment Share on other sites More sharing options...
mofm Posted April 17, 2008 Share Posted April 17, 2008 im guessing that $username is empty ? or it doenst exist maybe a typo or somthing ? Try echo $_post['user']; and see if the variable is comething onto the page this may help you out Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.