displaying messages in first file itself

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shivam0101
Forum Contributor
Posts: 197
Joined: Sat Jun 09, 2007 12:09 am

displaying messages in first file itself

Post by shivam0101 »

Hello,

I am having 2 files, 1-having form, 2-sql statements to insert form values. After execution of sql statements, i will display messages. I want these messages to be shown in the file having form. i.e first file itself.

I tried

Code: Select all

header("Location: first_file.php?message_id=$id");
and then in the first file, i can display their respective messages. But, i do not want to send these message_ids in querystring.

Thanks
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

just do everything on one page

Post by yacahuma »

just do everything on one page. Put the sql stuff in a library.

dont do that in 2 pages.

Code: Select all

<?
$retmsg='';
if (isset($_POST['submitbtn]'))
{
   $retmsg = mylib->function($_POST['values']);
}
?>

<html>
<?
if (strlen($retmsg)>0)
{
   display message here
}
?>
<form>
  <input type="submit" name="submitbtn">
</form>
</html>
Post Reply