View Single Post
Old 07-06-2002, 05:03 PM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,713
redhead is on a distinguished road
Quite simple:
Code:
<?php
  if(!isset($preview) || (isset($preview) && $preview == 1))
  {
    if(isset($preview))
      {
        echo "your current issue is:<br>
           some setup of how the $whatever_fieldnames should be shown";
      }
    else
        $preview =0;
    echo "
             <form action='$PHP_SELF' method=post>
              <input type=hidden value='$preview+1' name='preview'>
               <input type='text' name='some_field' value='$some_field'> 
               <!-- and so on with the rest of the fields used -->
              <input type=submit></form>
              ";
  }
else
   {
        /* $preview must be > 1 
            thus its a second submission.
        */
          $DB=mysql_connect("localhost", "user", "passwd");
          mysql_select_db("some_db");
          mysql_query("INSERT INTO whatever VALUES (some_field='$some_field' ...)", $DB);
  header("Location: /what/ever/page.php");
  }
?>
Only one page for everything, only drawback for this one, is, theres only one preview, uppon seccond submit you'll have the entry parsed onto your sql database. But then again you're forcing the user to have that one preview.

Or did I missunderstood your question? In this, the user will uppon submit, be shown a preview, he can chose to change something in it, or leave as it is, and just press submit again, which will store the info in your database. It needs some error checking, but for a fast one, it covers the aspects.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001

Last edited by redhead; 07-07-2002 at 01:34 AM.
redhead is offline   Reply With Quote