Page 1 of 1

displaying messages in first file itself

Posted: Wed Aug 01, 2007 10:46 am
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

just do everything on one page

Posted: Wed Aug 01, 2007 12:31 pm
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>