473,405 Members | 2,310 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,405 software developers and data experts.

Making a BACK buntton work

Hie

Could someone please help me I'm trying to make a back button and I'm trying not to make the button a submit button. The action or the redirection to another page is done using php and my code is as follows:

Expand|Select|Wrap|Line Numbers
  1. <link href="css/jobSheet.css" rel="stylesheet" type="text/css" />
  2. <?php
  3.  session_start();
  4. ?>
  5.  
  6. <html> 
  7. <head>
  8.  </head>
  9.   <body>
  10.   <?php
  11.     require_once('dbFunction.php');
  12.     ?>  
  13.  
  14.     <form method="post" action="returnToRedirectNewClientJobsheet.php" onSubmit="displayOldInfo()">
  15. <?php
  16. dbConnect();
  17.  
  18. $role = mysql_query("SELECT * FROM STATUS_DESC") or die(mysql_error());
  19. $staff = mysql_query("SELECT * FROM STAFF")
  20. ?>
  21.  
  22. <table width="75%" cellpadding="5" cellspacing="0" class="borderTop" align="center">
  23.     <td colspan="2" bgcolor="#FFCC00" align="center"><strong>New Client Jobsheet</strong></td>
  24.     <tr>
  25.  
  26.   <td align="left" width="65%" valign="top">
  27.         <table align="left" width="100%" cellpadding="5" cellspacing="0">
  28.  
  29.         <tr align="center" class="formHeader">
  30.           <td width="47%" bgcolor="#FFCC00"><strong>Client details</strong>
  31.         <td width="53%" bgcolor="#FFCC00"><strong>Job sheet details</strong>        </td>
  32.           </tr>
  33.           <tr>
  34.             <td valign="top" align="center"><table cellpadding="4" class="formText">
  35.                 <tr><td>Client name<td>
  36.                       <?=$_SESSION['firstName']; ?></td>
  37.                 <tr><td>Client Lastname<td>
  38.                       <?=$_SESSION['lastName']; ?></td>
  39.                 <tr><td>Client Title<td>
  40.                       <?=$_SESSION['client_title']; ?></td>
  41.                 <tr><td>Company name<td>
  42.                       <?=$_SESSION['company_name']; ?></td>
  43.                 <tr><td>Company code<td>
  44.                       <?=$_SESSION['company_code'] ?></td>
  45.                 <tr><td>Site address<td>
  46.                       <?=$_SESSION['Site_address']; ?></td>
  47.                 <tr><td>Postal Address<td>
  48.                       <?=$_SESSION['postal_address']; ?></td>
  49.                 <tr><td>Phone number<td>
  50.                        <?=$_SESSION['phone_number']; ?></td>
  51.                 <tr><td>E-mail<td>
  52.                        <?=$_SESSION['email_address']; ?></td>
  53.                 <tr><td>Website<td>
  54.                         <?=$_SESSION['website']; ?></td>
  55.                 </tr>    
  56.             </table>
  57.  
  58.             <td valign="top" align="center">
  59.  
  60.             <table cellpadding="3">
  61.                    <tr><td class="formText">Job Sheet Number
  62.                    <td class="formText">
  63.                       <?=$_SESSION['jobID']; ?></td>
  64.                 <tr><td class="formText">Date<td class="formText"><?=$_SESSION['date']; ?></td>
  65.                 <tr><td class="formText">Assigned to
  66.                   <td><?php
  67.                      $aStaffID = $_SESSION['assignedStaff'];
  68.                      $staffQuery= mysql_query("SELECT username FROM STAFF WHERE staffID ='$aStaffID' ")or die (mysql_error());
  69.                       $results = mysql_fetch_array($staffQuery);
  70.                       echo $results[0];
  71.                             ?></td>
  72.                 <tr><td class="formText">Assigned Date
  73.                   <td><?=$_SESSION['assingedDate']; ?>
  74.  
  75.                 <tr><td class="formText">Assigned Time
  76.                 <td>
  77.                        <?=$_SESSION['assignedTime'];
  78.                        ?>
  79.              </td>
  80.                 <tr><td>Status<td>
  81.                         <?=$_SESSION['status'];
  82.                         ?>
  83.                  </td>
  84.         </table>
  85.         <tr><td></td></tr>
  86.     <tr>
  87.         <td colspan="2" align="center" class="borderTop" bgcolor="#FFCC00"><span class="formHeader"> <strong>Request</strong></span></td></tr>
  88.         <tr>
  89.         <td colspan="2" align="center" class="borderTop" bgcolor="#FFCC00"><span class="formHeader">
  90.         <strong>Title :<?=$_SESSION['title']; ?>
  91.         </strong></span></td></tr>
  92.             <tr>
  93.           <td colspan="2" align="center"><textarea name="textarea" cols="70" rows="10" class="textAreaBorder">
  94.                        <?=$_SESSION['request']; ?>
  95.            </textarea></td></tr>
  96.            <tr>
  97.           <tr><td colspan="2" align="center" class="borderTop" bgcolor="#FFCC00">
  98.         <input type="reset" name="clear" value="&lt;&lt;Undo" class="button" >       
  99.         <input type="submit" name="submit" value="Continue&gt;&gt;" class="button">
  100.      </td></tr>
  101.       </table>
  102.       </td>
  103.   </tr>          
  104.  
  105. </table>
  106.       </td>
  107.   </tr>
  108.   </table>      
  109.  
  110. </form>
  111. </body>
  112. </html>
  113. <script language="JavaScript">
  114. <!--
  115. var SymRealOnLoad;
  116. var SymRealOnUnload;
  117.  
  118. function SymOnUnload()
  119. {
  120.   window.open = SymWinOpen;
  121.   if(SymRealOnUnload != null)
  122.      SymRealOnUnload();
  123. }
  124.  
  125. function SymOnLoad()
  126. {
  127.   if(SymRealOnLoad != null)
  128.      SymRealOnLoad();
  129.   window.open = SymRealWinOpen;
  130.   SymRealOnUnload = window.onunload;
  131.   window.onunload = SymOnUnload;
  132. }
  133.  
  134. SymRealOnLoad = window.onload;
  135. window.onload = SymOnLoad;
  136.  
  137. //-->
  138.  
[Please use CODE tags when posting source code. Thanks! --pbmods]

There are two buttons on the page- the submit button and the clear button. I want the clear button to redirect the person back to the previous page. I have tried unsing forms but my page loses its structure when I do that. Is there another way to to this

Thank you
Jun 3 '07 #1
2 1504
Would this do it? (a bit of ye old javascript):

Expand|Select|Wrap|Line Numbers
  1. <input type="reset" name="clear" value="<<Undo" class="button" onclick="history.back();">
  2.  
[Please use CODE tags when posting source code. Thanks! --pbmods]
Jun 3 '07 #2
henryrhenryr
103 100+
If you really do want to send someone literally back to the previous page you could also just use an anchor tag with the href or just history.back() to use the javascript

[HTML]<a class="button" href="enterlink" onclick="history.back()">clear</a>[/HTML]

If you tweak the CSS you can get something approximating a button for your anchor tag.

Expand|Select|Wrap|Line Numbers
  1. .button {
  2.       font-family: verdana;
  3.       padding: 2px 10px 2px 10px;
  4.       background-color: #cccccc;
  5.       border: 1px solid #888888;
  6.       color: #444444;
  7.       text-align: center;
  8.       font-size: 0.8em;
  9.       text-decoration: none; 
  10.       cursor: pointer; 
  11. }
  12.  
Jun 4 '07 #3

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

Similar topics

4
by: David Walker | last post by:
Hi I have a Microsoft SQL database I can use (also mySQL, so if you know how to do this in mySQL that is just as useful). The database can only be accessed from webpages hosted on the same server...
34
by: Ian Rastall | last post by:
I'm doing a small project right now where I create a table from a database. This is the code, which Dreamweaver, for the most part, has written: *** <?php mysql_select_db($database_tdream,...
16
by: a | last post by:
We are writing an app that assigns people to teams based on their curent score. Teams are 8 people, there are 2 teams. (i would like it to be flexible, but this is a start). I need an algorithm...
21
by: PlainDave | last post by:
Hi, Is there a way to make windows tooltips stay up longer than the default 5 seconds using CSS in a web page? I'd prefer to have it stay visible as long as the mouse is over the "whatever." The...
351
by: CBFalconer | last post by:
We often find hidden, and totally unnecessary, assumptions being made in code. The following leans heavily on one particular example, which happens to be in C. However similar things can (and...
10
Ajm113
by: Ajm113 | last post by:
Making a History Page for BIG Sites Intro: Ok, let's say after a while your website has grown massive. We're talking search engine, forum and video hosting -- you've got a LOT of content. And you...
2
by: CoopEng | last post by:
Hey all, I've been pouring through hundreds of forums recently and finally decided that I should get in on the action. I am trying to update some forms and reports, also some minor back end...
16
by: Andrea Gavana | last post by:
Hi Diez & All, Do you mind explaining "why" you find it *buttugly*? I am asking just out of curiosity, obviously. I am so biased towards wxPython that I won't make any comment on this thread...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.