473,385 Members | 1,641 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,385 software developers and data experts.

to go to another page by clicking a button in html

in html we go another page by
using this
<form action="one.html">
but i have to do go to another page after clciking a button....ie if i click different buttons the ni shuld go to different page. but in form tag we can go only to one form but i want to go to multiple form after a button click.

ie i want to insert in the backend, also update in backend delete etc...
therefore if i click insert button then i shuld go to insert form
if i delete button i shuld go to delete form...

.ie i shuld go to form on button click
Apr 2 '08 #1
2 19216
I think this will fulfil your requirement

Expand|Select|Wrap|Line Numbers
  1. function delete()
  2.     {
  3.        document.formName.action="delete.html";
  4.        document.formName.submit();
  5.     }
then add this function in the button you want
Apr 2 '08 #2
hsriat
1,654 Expert 1GB
That can be achieved in two ways.

First:
Change the action of the form depending upon the submit button to click.
For that, add similar code to each submit button for different files, update.php, delete.php etcetera[html]<input type="submit" name="update" value="Update" onclick="document.forms[0].action = 'update.php'; return true;">[/html]

Second:

On the server side, you can write the whole code in a same file and divide it according to the submit button clicked.
eg.[php]<?php
if (isset($_POST['update']))
{
//WRITE CODE FOR UPDATE
}
elseif (isset($_POST['delete']))
{
//WRITE CODE FOR DELETE
}
else
{
die('Invalid request');
}[/php]
Where update and delete are the names of the submit buttons.
If you are not using PHP, I hope you can translate it to your required language.
Apr 2 '08 #3

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

Similar topics

12
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
1
by: Zaidan | last post by:
I am running Excel2000 under WIN98 2nd edition, and I am writing a VBA code (I will consider using javascript if I have to) that does the following, at the user command: 1- Start MS Explorer and...
2
by: anonieko | last post by:
Scenario: You have a page that is TOO slow to refresh. But it allows partial flushing of html contents. I.e. Submit button already appears but you don't want your users to click on it prematurely...
7
by: Matt | last post by:
Hi all, Not very sure about this. I have one button (not a submit button) will "post" partial page(form) info to another url(the user will also redirect to this url :-). I dont' want to change...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
8
by: rn5a | last post by:
I have a HTML page named Index.html which is divided into 3 frames. The URL of 2 of the frames are HTML pages but the 3rd frame houses a ASP page. Now when I go to Windows Explorer, navigate to...
16
nirmalsingh
by: nirmalsingh | last post by:
hai experts, i am having page called main.html, when the user clicks a button in this page a popup window of pop.html is opened. in pop.html user enter his name and close that popup window. now...
1
by: SUHASbioinfo | last post by:
Hi All, I have created two web pages (Login page & User Page), Login page has a form of which method is get & action is "\\localhost\login.pl" , and submit button (action = submit), This login...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.