I've encountered this several times.  When on the web I just use redirect
pages.

I'll submit the data to a page that puts the information into the database,
and then puts a header() call to redirect them to the real finishing page,
passing any minor variables I may need.

This way also has the unique ability that you can go back and forth in the
browser all you want (no back button woes).
----- Original Message -----
From: "Pete Kuczynski" <[EMAIL PROTECTED]>
To: "MySQL Email List" <[EMAIL PROTECTED]>
Sent: Thursday, June 07, 2001 8:32 AM
Subject: Re: MySQL with perl


> I overcame this by adding to my php script, something that goves the
> user the results, summerised, of what they added to the database, thus
> when hitting refresh, it just refreshes the results of what the php
> script returned, not what they submitted.
> My php script is below.
> Pete
> <html>
>      <body>
>      <?php
>
>      require("fedb.inc");
>
>      mysql_connect(localhost,$user,$password);
>
>      @mysql_select_db($db) or die( "Unable to select database");
>
>      /*Insert into database */
>
>
>      mysql_query ("INSERT INTO asset (site_id, hostname, device, model,
> serial, ip,
>                    dept, mhz, ram, hd_size, os_ver, status, data_port,
> pp_port, hub_port,
>                    digi_port, csmim_port, tprmim_port, xyplex_port,
> comments, fe)
>                     VALUES ('$site_id', '$hostname', '$device',
> '$model', '$serial', '$ip',
>                              '$dept', '$mhz', '$ram', '$hd_size',
> '$os_ver', '$status',
>                              '$data_port', '$pp_port', '$hub_port',
> '$digi_port',
>                              '$csmim_port', '$tprmim_port',
> '$xyplex_port',
>                              '$comments', '$fe')
>                   ");
>
>
>
>
>      print ($site_id);
>      print (" ");
>
>
>
>      print ($hostname);
>      print (" ");
>
>
>
>      print ($device);
>      print (" ");
>
>
>      print ($model);
>
>      print (" ");
>
>      print ($serial);
>
>      print (" ");
>
>      print ($ip);
>
>      print (" ");
>
>      print ($dept);
>
>      print (" ");
>
>      print ($mhz);
>
>      print (" ");
>
>      print ($ram);
>
>      print (" ");
>
>      print ($hd_size);
>
>      print (" ");
>
>      print ($os_ver);
>
>      print (" ");
>
>      print ($status);
>
>      print (" ");
>
>      print ($data_port);
>
>      print (" ");
>
>      print ($pp_port);
>
>      print (" ");
>
>      print ($hub_port);
>
>      print (" ");
>
>      print ($digi_port);
>
>      print (" ");
>
>      print ($csmim_port);
>
>      print (" ");
>
>      print ($tprmim_port);
>
>      print (" ");
>
>      print ($xyplex_port);
>
>      print (" ");
>
>      print ($comments);
>
>      print (" ");
>
>      print ($fe);
>
>      print (" ");
>
>      print ("<p>");
>
>      print ("<p>");
>
>      print ("Thanks for submitting your device.");
>
>
>
>      ?>
>
>      <a href='index.html'><b>Home</b></a> |
>      <a href='searchform.html'><b>Search Item</b></a> |
>      <a href='searchform_all.html'><b>Search Site</b></a> |
>      <a href='updateform.html'><b>Update</b></a> |
>      <a href='deleteform.html'><b>Delete</b></a>
>
>      </body>
>      </html>
>
>
>
>
> Cindy wrote:
> >
> > "Dawn H" writes:
> >  >I've written a couple of scripts and have a thing that I haven't quite
> >  >figured out. If anyone can shed light on this, I'd appreciate it.
> >  >
> >  >When a person submits a form that inserts a record into the database,
if
> >  >they then refresh the page that comes up after the submit, the record
will
> >  >be submitted a second time.  I suppose this is due to the fact that
the
> >  >subroutine that is called with the submit contains both the write to
> >  >database bit and the view bit. So refreshing causes a repeat of both
items.
> >  >
> >  >How can I do this without that problem?
> >
> > I was finally forced to add a check that there wasn't already an
> > identical record (using a minimum comparison set of fields) before
> > inserting the record.  There really isn't any way to prevent dingbats
> > from refreshing, so...  I CYA by emailing a copy of the record/element
> > values to myself when I refuse to add it in, but I havne't had any
> > spurious refusals so far.
> >
> > --Cindy
> >
> > ---------------------------------------------------------------------
> > Before posting, please check:
> >    http://www.mysql.com/manual.php   (the manual)
> >    http://lists.mysql.com/           (the list archive)
> >
> > To request this thread, e-mail <[EMAIL PROTECTED]>
> > To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
> --
> _______________________________________
> Pete Kuczynski
> Principal Field Engineer
> DHL Airways Inc.
> Infrastructure Technology & Services
> (773)-462-9758
> 24/7 Helpdesk 1-800-434-5767
>


----------------------------------------------------------------------------
----


> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to