473,402 Members | 2,064 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

why does my form submit when i press the refresh button

69
If I press the refresh button on my web form it submits the form and add the default values or whatever values that were there to the database.could anyone help me by giving me some sort of solution to this problem
Nov 7 '07 #1
13 2850
Markus
6,050 Expert 4TB
It should only submit if the user has pressed return or selected the 'submit' button.

But, if this, for some (strange) reason, isn't the case, you can counter it with PHP.

I'm sure you could with JavaScript but i'm not sure how you would do that...

assuming you're submitting to the same page:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $submitButton = $_POST['submit']; //name of submit button from form!
  3. if(isset($submitButton)){
  4.   //code to execute if submit button has been clicked
  5. } else {
  6.   //otherwise just show the form
  7. }
  8. ?>
  9.  
Hope this helped.
Nov 7 '07 #2
steven
143 100+
Sigh... if you want help, you really should HELP US to help you!

A snippet of code, or even a better explanation would go a long way in helping us to help you.
Nov 7 '07 #3
you can restrict by a property (if page.ispostback=true) in vb code
Nov 8 '07 #4
phpmel
69
hi markusn00b,

Thank you for your reply,
Sorry for not posting my code.
I did as you said and it is still not working.

This is what savedata.php looks like
[PHP]<?php

if(isset($_POST['save'])){
//save the form values to database
}

include form.php;

?>
[/PHP]
And form.php is the code that actually creates my form with the submit button named save.

Can someone please help me.
Nov 12 '07 #5
acoder
16,027 Expert Mod 8TB
Do you get a browser confirmation alert asking if the form values should be posted again?

Can you post the code for form.php?
Nov 12 '07 #6
phpmel
69
Hi,
No i didnt get a browser confirmation alert.

the form.php script is pretty complicated where it includes a table for formatting ,php to get data from db to populate drop down boxes and stuff. I am going to TRY and highlight what i think might be applicable for you to help me.

Expand|Select|Wrap|Line Numbers
  1.  
  2. <form id="form_body" name="form_body" method="post" action="">
  3. <table //and all its attributes>
  4. <tr>//table rows that creates and populates the numerous text boxes and dropdown boxes
  5.  
  6. </tr>
  7. <input name="save" type="submit" id="save" value="SAVE CALL DATA" onclick="return validateform()" tabindex="-1" onKeyDown="if(event.keyCode==13) event.keyCode=9;"/>//actual code for my submit button
  8.  
  9. </table>
  10. </form>
  11.  
Nov 12 '07 #7
acoder
16,027 Expert Mod 8TB
Can you show the code for the "refresh button"?
Nov 13 '07 #8
phpmel
69
Hi,

I am not sure what you are talking about. I dont have any code for the 'REFRESH' button. The refresh button i am talking about is the one on the web browser itself.
Nov 13 '07 #9
acoder
16,027 Expert Mod 8TB
I asked because you said:
If I press the refresh button on my web form it submits the form
Can you give the code for the full page?
Nov 13 '07 #10
phpmel
69
Hi acoder,
sorry about that. I meant web browser not web form, my fault.


This is what the form.php looks like

Code: (php)
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>FORM</title>
  6. <!-- InstanceEndEditable -->
  7. <style type="text/css">
  8. <!--
Expand|Select|Wrap|Line Numbers
  1. .style1 {
  2.     color: #FFFFFF;
  3.     font-family: Verdana, Arial, Helvetica, sans-serif;
  4.     font-style: normal;
  5.     font-weight: lighter;
  6.     font-size: 20px;
  7. }
  8. body {
  9.     background-color: #FFFFFF;
  10.     margin-left: 0px;
  11.     margin-top: 0px;
  12.     margin-right: 0px;
  13.     margin-bottom: 0px;
  14. }
  15. .style2 {
  16.     font-size: 20px;
  17.     font-family: Verdana, Arial, Helvetica, sans-serif;
  18. }
  19. .style3 {
  20.     font-size: 18px;
  21.     font-weight: bold;
  22.     color:#0000CC
  23. }
Expand|Select|Wrap|Line Numbers
  1. -->
  2. </style>
  3. <!-- InstanceBeginEditable name="head" -->
  4. <style type="text/css">
  5. <!--
Expand|Select|Wrap|Line Numbers
  1. .style7 {
  2.     font-size: 16px;
  3.     font-weight: bold;
  4. }
  5. .style8 {color: #0000FF}
  6. .style11 {color: #000000}
  7. .style14 {font-family: Verdana, Arial, Helvetica, sans-serif}
  8. .style15 {
  9.     color: #000000;
  10.     font-size: 20px;
  11.     font-family: Verdana, Arial, Helvetica, sans-serif;
  12. }
  13. .style16 {color: #FF0000}
Expand|Select|Wrap|Line Numbers
  1. -->
  2. </style>
  3. <!-- InstanceEndEditable -->
  4. </head>
  5.  
  6. <body>
  7. <table width="700" height="244" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
  8.   <tr bordercolor="#FF0000">
  9.     <th width="794" height="136" bordercolor="#FFFFFF" scope="col"><img src="/Pictures/Operator_Banner.jpg" alt="Web page banner" width="791" height="136" longdesc="/Pictures/Operator_Banner.jpg" /></th>
  10.   </tr>
  11.   <tr bordercolor="#0000FF" bgcolor="#0000FF">
  12.     <td height="107" bordercolor="#FFFFFF" bgcolor="#FFFFFF"><div align="center">
  13.       <table width="775" border="0">
  14.         <tr bordercolor="#99CCFF">
  15.           <td><div align="center"><img src="/Pictures/menu.jpg" alt="menu" width="775" height="30" border="0" usemap="#Map" /></div></td>
  16.           </tr>
  17.  
  18.         <!-- InstanceBeginEditable name="body" -->
  19.         <script src="functions.js" type="text/javascript" language="javascript">
  20.  
  21.         </script>
  22.  
Expand|Select|Wrap|Line Numbers
  1.         <?php
  2.         error_reporting(E_ALL);
  3.         ini_set('display_errors',true);
  4.         require_once('./connection_variables.php');
  5.         @mysql_pconnect(SQL_HOST, SQL_USER,SQL_PASS) OR die('Could not connect to the database. ' .                mysql_error());
  6.  
  7.         @mysql_select_db(SQL_DBOC);
  8.         ?>
Expand|Select|Wrap|Line Numbers
  1.         <tr>
  2.           <td><form id="form_body" name="form_body" method="post" action="">
  3.             <table width="784" border="0" align="center" cellpadding="1" cellspacing="0" bordercolor="#FFFFFF" bgcolor="#CCFFFF" id="tbl_bodyCallLog">
  4.               <tr>
  5.                 <td width="188" rowspan="2" bordercolor="#FFFFFF" bgcolor="#99CCFF"><label class="style2">
  6.                   <div align="left" class="style7 style14"><span class="style2"><span class="style7">DATE:</span></span></div>
  7.                 </label></td>
  8.                 <td width="154" bordercolor="#FFFFFF" bgcolor="#FFFFFF"><div align="left"></div>
  9.                   <div align="left"></div>
  10.                   <div align="left"></div>
  11.                   <div align="left"></div>
  12.                   <div align="left"></div>
  13.                   <div align="left"></div></td>
  14.                 <td width="170" rowspan="2" bordercolor="#FFFFFF" bgcolor="#FFFFFF">&nbsp;</td>
  15.                 <td width="2" rowspan="2" bordercolor="#FFFFFF" bgcolor="#FFFFFF">&nbsp;</td>
  16.                 <td rowspan="2" bordercolor="#FFFFFF" bgcolor="#FFFFFF">&nbsp;</td>
  17.                 <td width="233" rowspan="2" bordercolor="#FFFFFF" bgcolor="#FFFFFF">&nbsp;</td>
  18.                 <td rowspan="2" bordercolor="#FFFFFF" bgcolor="#FFFFFF">&nbsp;</td>
  19.                 <td width="17" rowspan="2" bordercolor="#FFFFFF" bgcolor="#FFFFFF">&nbsp;</td>
  20.               </tr>
  21.               <tr>
  22.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFFF"><div align="left">
  23.                 <label></label>
  24.                 </div></td>
  25.                 </tr>
  26.               <tr>
  27.                 <td height="38" bordercolor="#FFFFFF" bgcolor="#FFFFCC" class="style7"><div align="left">FIRST NAME:</div></td>
  28.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC"><div align="left">
  29.                   <label></label>
  30.                   <label>
  31.                   <input name="f_name" type="text" id="f_name" size="15" tabindex="2" onKeyDown="if(event.keyCode==13) event.keyCode=9;" onchange="change('f_name')"/>
  32.                   </label>
  33.                 </div></td>
  34.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC" class="style7">
  35.                 <td rowspan="2" bordercolor="#FFFFFF" bgcolor="#FFFFCC" class="style7"><div align="left"></div></td>
  36.                 <td rowspan="2" bordercolor="#FFFFFF" bgcolor="#FFFFCC" class="style7"><div align="left"></div></td>
  37.                 <td colspan="3" bordercolor="#FFFFFF" bgcolor="#FFFFCC" class="style7"><div align="left">
  38.                   <p class="style7">
  39.                     <label>
  40.  
  41.                     </label>
  42.                   </p>
  43.                   </div></td>
  44.                 </tr>
  45.                 <tr>
  46.                 <td height="21" bordercolor="#FFFFFF" bgcolor="#FFFFCC" class="style7"><div align="left">LAST NAME: </div></td>
  47.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC"><label>
  48.                   <div align="left">
  49.                     <input name="l_name" type="text" size="15" tabindex="4" onKeyDown="if(event.keyCode==13) event.keyCode=9;" onchange="change('l_name')"/>
  50.                     </div>
  51.                 </label></td>
  52.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC" class="style7">&nbsp;</td>
  53.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC" class="style7">&nbsp;</td>
  54.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC" class="style7">&nbsp;</td>
  55.                 <td colspan="3" bordercolor="#FFFFFF" bgcolor="#FFFFCC" class="style16"></td>
  56.               </tr>
  57.               <tr>
  58.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC"><div align="left"></div></td>
  59.                 <td colspan="6" bordercolor="#FFFFFF" bgcolor="#FFFFCC"><div align="left"></div></td>
  60.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC"><div align="left"></div></td>
  61.               </tr>
  62.               <tr>
  63.                 <td colspan="8" bordercolor="#FFFFFF" bgcolor="#99CCFF" class="style15"><div align="left">EXTENSION DETAILS: </div></td>
  64.                 </tr>
  65.               <tr>
  66.                 <td height="25" rowspan="2" bordercolor="#FFFFFF" bgcolor="#FFFFCC"><div align="left"><span class="style7">EXTENSION #: </span></div></td>
  67.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC"><div align="left">
  68.                   <label>                  </label>
  69.                 </div></td>
  70.                 <td rowspan="2" bordercolor="#FFFFFF" bgcolor="#FFFFCC" class="style7"><div align="left">DEPARTMENT : </div></td>
  71.                 <td rowspan="2" bordercolor="#FFFFFF" bgcolor="#FFFFCC">&nbsp;</td>
  72.                 <td rowspan="2" bordercolor="#FFFFFF" bgcolor="#FFFFCC">&nbsp;</td>
  73.                 <td colspan="3" rowspan="2" bordercolor="#FFFFFF" bgcolor="#FFFFCC"><label>
  74.                   <div align="left">
  75.  
Expand|Select|Wrap|Line Numbers
  1.                     <?php
  2.                 $query = "select Department from Departments";
  3.                 $result = mysql_query($query);
  4.                 echo "<select name=\"Petrotrin_departments_ext\" onchange=\"change('Petrotrin_departments_ext')\">";
  5.  
  6.                 echo"<option selected=\"selected\">---------------------------------SELECT---------------------------------</option>";
  7.  
  8.  
  9.                 while($row = mysql_fetch_array($result, MYSQL_NUM)){
  10.                     $department = $row[0];
  11.  
  12.                     echo"<option>$department</option>";
  13.                 }
  14.  
  15.                 echo "</select>";            
  16.  
  17.            ?>
Expand|Select|Wrap|Line Numbers
  1.         </div>
  2.                 </label></td>
  3.                 </tr>
  4.               <tr>
  5.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC"><label>
  6.                   <div align="left">
  7.                       <input name="extension_num" maxlength="4" type="text" id="extension#" size="15" tabindex="6" onKeyDown="if(event.keyCode==13) event.keyCode=9;" onchange="change('extension_num')" onblur="return CheckExt('extension#')"/>
  8.                   </div>
  9.                 </label></td>
  10.               </tr>
  11.               <tr>
  12.                 <td height="50" bordercolor="#FFFFFF" bgcolor="#FFFFCC">&nbsp;</td>
  13.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC">&nbsp;</td>
  14.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC" class="style7"><div align="left">LOCATION:</div></td>
  15.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC">&nbsp;</td>
  16.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC">&nbsp;</td>
  17.                 <td colspan="3" bordercolor="#FFFFFF" bgcolor="#FFFFCC"><label>
  18.                   <div align="left">
  19.                     <label>
  20.  
Expand|Select|Wrap|Line Numbers
  1.             <?php
  2.                 $query = "select Location from Petrotrin_locations";
  3.                 $result = mysql_query($query);
  4.                 echo "<select name=\"Petrotrin_locations_ext\" onchange=\"change('Petrotrin_locations_ext')\" >";
  5.  
  6.                 echo"<option selected=\"selected\">-------------------SELECT-------------</option>";
  7.                 //echo"<option selected=\"selected\">Point-a-Pierre</option>";
  8.  
  9.                 while($row = mysql_fetch_array($result, MYSQL_NUM)){
  10.                     $location = $row[0];
  11.  
  12.                     echo"<option>$location</option>";
  13.                 }
  14.  
  15.                 echo "</select>";
  16.  
  17.  
  18.             ?>
Expand|Select|Wrap|Line Numbers
  1.                     </label>
  2.                   </div>
  3.                   </label></td>
  4.                 </tr>
  5.               <tr>
  6.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC">&nbsp;</td>
  7.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC">&nbsp;</td>
  8.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC" class="style7"><div align="left">ADDITIONAL INFO:<span class="style16">*</span> </div></td>
  9.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC">&nbsp;</td>
  10.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC">&nbsp;</td>
  11.                 <td colspan="3" bordercolor="#FFFFFF" bgcolor="#FFFFCC"><label>
  12.                   <div align="left">
  13.                     <input name="phone_address" type="text" id="phone_address" size="40" tabindex="7" onKeyDown="if(event.keyCode==13) event.keyCode=9;"/>
  14.                     </div>
  15.                 </label></td>
  16.               </tr>
  17.               <tr bgcolor="#00FFFF">
  18.                 <td colspan="8" bordercolor="#FFFFFF" bgcolor="#99CCFF" class="style2 style11"><div align="left">CALL DETAILS: </div></td>
  19.                 </tr>
  20.               <tr>
  21.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC" class="style7"><div align="left">CALL TYPE:</div></td>
  22.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC"><label>
  23.                   <div align="left">
  24.                     <select name="ddl_CallType" id="callType_ddl" tabindex="8" onKeyDown="if(event.keyCode==13) event.keyCode=9;">
  25.                       <option>Company</option>
  26.                       <option>Personal</option>
  27.                     </select>
  28.                   </div>
  29.                 </label>                    </td>
  30.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC"><div align="left"><span class="style7">NAME OF COMPANY: </span></div></td>
  31.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC"><div align="left"></div></td>
  32.                 <td width="2" bordercolor="#FFFFFF" bgcolor="#FFFFCC"><div align="left"></div></td>
  33.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC"><div align="left">
  34.                   <input type="text" name="company_name" size="40" onchange="change('company_name')" onblur="return checkname()" tabindex="9" onKeyDown="if(event.keyCode==13) event.keyCode=9;"/>
  35.                 </div></td>
  36.                 <td width="2" bordercolor="#FFFFFF" bgcolor="#FFFFCC"><div align="left"></div></td>
  37.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC"><div align="left"></div></td>
  38.               </tr>
  39.               <tr>
  40.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC" class="style7">&nbsp;</td>
  41.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC">&nbsp;</td>
  42.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC">&nbsp;</td>
  43.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC">&nbsp;</td>
  44.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC">&nbsp;</td>
  45.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC">&nbsp;</td>
  46.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC">&nbsp;</td>
  47.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC">&nbsp;</td>
  48.               </tr>
  49.               <tr>
  50.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC" class="style7"><div align="left">NUMBER CALLED: </div></td>
  51.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC"><div align="left">
  52.                   <input name="txt_numberCalled" type="text" size="15"  maxlength="20" tabindex="10" onKeyDown="if(event.keyCode==13) event.keyCode=9;" onchange="change('txt_numberCalled')"  onblur="return PhoneCheck('txt_numberCalled')"/>
  53.                 </div></td>
  54.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC"><label> </label>
  55.                     <div align="left"><span class="style7">NAME OF CONTACT: </span>                    </div></td>
  56.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC"><div align="left"></div></td>
  57.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC"><div align="left"></div></td>
  58.                 <td colspan="4" bordercolor="#FFFFFF" bgcolor="#FFFFCC">
  59.                   <div align="left">
  60.                   <input name="txt_contact_name" type="text" size="40" tabindex="11" onKeyDown="if(event.keyCode==13) event.keyCode=9;" onchange="change('txt_contact_name')"/>
  61.                     </div></td></tr>
  62.               <tr>
  63.                 <td height="38" bordercolor="#FFFFFF" bgcolor="#FFFFCC"><div align="left" class="style7">
  64.                   <div align="left">CONNECTED:</div>
  65.                 </div></td>
  66.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC"><label>
  67.                   <div align="left">
  68.                     <select name="ddl_connected" id="connected_ddl" tabindex="12" onKeyDown="if(event.keyCode==13) event.keyCode=9;">
  69.                       <option>YES</option>
  70.                       <option>NO</option>
  71.                     </select>
  72.                     </div>
  73.                 </label></td>
  74.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC"><div align="left"><span class="style7">OPERATOR:</span></div></td>
  75.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC"><div align="left"></div></td>
  76.                 <td bordercolor="#FFFFFF" bgcolor="#FFFFCC" class="style7"><div align="left"></div></td>
  77.                 <td colspan="3" bordercolor="#FFFFFF" bgcolor="#FFFFCC"><label>
  78.  
  79.                 <div align="left">
  80.                 <label>
Expand|Select|Wrap|Line Numbers
  1.             <?php
  2.             $query = "select CONCAT(LastName, ', ',FirstName) from Operators order by LastName";
  3.             $result = mysql_query($query);
  4.             echo"<select name=\"operators\" onchange=\"change('operators')\">";
  5.  
  6.             echo"<option selected=\"selected\">-------------------SELECT-------------</option>";
  7.  
  8.  
  9.             while($row = mysql_fetch_array($result, MYSQL_NUM)){
  10.                 $name = $row[0];
  11.  
  12.                 echo"<option>$name</option>";
  13.             }
  14.  
  15.  
  16.  
  17.             echo "</select>";    
  18.         ?>
Expand|Select|Wrap|Line Numbers
  1.                 </label>
  2.                </div>
  3.                 </label>                 <label>
  4.  
  5.  
  6.                 </label></td>
  7.                 </tr>
  8.               <tr bgcolor="#99ccff">
  9.                 <td height="18" colspan="8" bordercolor="#FFFFFF"><label></label>                  <label></label></td>
  10.                 </tr>
  11.               <tr bgcolor="#ffffcc">
  12.                 <td height="18" colspan="3" bordercolor="#FFFFFF"><label>
  13.                   <div align="left">
  14.                     <input name="save" type="submit" id="save" value="SAVE CALL DATA" onclick="return validateform()" tabindex="-1" onKeyDown="if(event.keyCode==13) event.keyCode=9;"/>
  15.                     <input name="reset" type="reset" id="reset" value="RESET FORM" tabindex="-2" onKeyDown="if(event.keyCode==13) event.keyCode=9;" onclick="toForm()"/>
  16.                     </div>
  17.                 </label></td>
  18.                 <td bordercolor="#FFFFFF">&nbsp;</td>
  19.                 <td bordercolor="#FFFFFF" class="style7">&nbsp;</td>
  20.                 <td colspan="3" bordercolor="#FFFFFF">&nbsp;</td>
  21.               </tr>
  22.             </table>
  23.           </form>          </td>
  24.           <td>&nbsp;</td>
  25.         </tr>
  26.         <!-- InstanceEndEditable -->
  27.       </table>
  28.     </div></td>
  29.   </tr>
  30. </table>
  31.  
  32. <map name="Map" id="Map">
  33. <area shape="rect" coords="4,1,101,19" href="http://corpweb/ittweb04/Default.htm" target="_self" />
  34. <area shape="rect" coords="126,3,314,17" href="/login.php" target="_self" />
  35. <area shape="rect" coords="149,3,150,10" href="#" /><area shape="rect" coords="132,3,133,14" href="#" /><area shape="rect" coords="326,2,516,22" href="#" />
  36. <area shape="rect" coords="539,4,628,22" href="#" /><area shape="rect" coords="644,4,772,16" href="http://corpweb/ittweb04/Policy.htm" target="_blank" />
  37. <area shape="rect" coords="690,4,692,9" href="#" /><area shape="rect" coords="3,1,13,6" href="#" /><area shape="rect" coords="8,9,30,11" href="#" /></map></body>
  38. <!-- InstanceEnd --></html>
  39.  

and well this is savedata.php
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. if(isset($_POST['save'])){
  3. //connect to the database
  4.  
  5. //manipulate the elements on the form
  6. }
  7.  
  8. //Include the form
  9. include "form.php";
  10.  
  11. ?>
sorry about that
Nov 14 '07 #11
acoder
16,027 Expert Mod 8TB
The form action is empty. Where do you set it?

savedata.php is the action page and it posts to itself. Correct?
Nov 14 '07 #12
phpmel
69
I am not sure.

The code was written by someone else and that is how they structured it. Should the action attribute have savedata.php as its parameters......action="savedata.php"

on the browser when i type http://savedata.php the all the stuff that was created and done in the form.php shows up and the form works fine. savedata also saves the stuff to the db fine too.

I am new to html and php and stuff so i am preety lost
Nov 14 '07 #13
Markus
6,050 Expert 4TB
So you want to submit the data only once and somehow prevent the refreshing of the page causing the data to be insterted again.

Maybe you should compare the data being submitted against what's already in the table, to see if it's already submitted?

mysql_numrows() is what you'd need! :)
Nov 14 '07 #14

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Pete Mahoney | last post by:
Ok I use a textarea to store data input by the user, and then upon them clicking the submit button I store this data to a database. The problem is once the user inputs too much data (about 3...
15
by: M Smith | last post by:
I have a form I want to submit to itself. I want to be able to type in a list of numbers and submit the form and have that list show up on the same form under the text box I typed them into and...
1
by: jrefactors | last post by:
When the user type something in text box, and press enter, it will submit the form data to test2.jsp, even without pressing submit form button. This is not what I want, I want to submit the form...
7
by: David T. Ashley | last post by:
Hi, For a web page, I want a SUBMIT button that commits the form data and a CANCEL button that goes to a different target (i.e. a different script). I haven't figured out how to do this,...
5
by: Ted Ngo | last post by:
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { txtSource.Focus(); frmMain.Visible = true; divWait.Visible = false; btnsubmit.Visible = true;
4
by: d3vkit | last post by:
I have a form on my page, and some javascript which uses ajax to submit the form, and then opens the new page in a div using ajax so there is no refresh. This works fine. But the problem is this: all...
9
by: learning | last post by:
Hi! Here's my situation: I have one textfield with one 'submit' button in PAGE1.PHP. When I click on the 'submit' button I am sent to PAGE2.PHP where I have a "switch" routine that checks...
12
by: Daniel Klein | last post by:
I'm pretty new at php and web stuff so please be gentle with me. I'm trying to get a form to submit when the user presses the Enter key. I do not want to use javascript. I've googled this to...
11
by: OldBirdman | last post by:
I have a form with several bound textboxes. These are routinely updated by User. The table in RecordSource for this form currently has 8 fields not shown on this form, but which occasionally need...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.