469,306 Members | 2,542 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

One form two destinations without JavaScript?

M2
Hi,
a have a single form whose elements reside in a table. I want to present a
"Submit" and "Cancel" button at the bottom each of which have a different
destination. This is of course easy to do if you either a) use javascript on
a button or b) go to the dark side and put a form within a table. I would
like to avoid these two techniques if possible. Any ideas?

Matt.
Jul 20 '05 #1
3 3927
"M2" <m2@nowhere.com> wrote:
a have a single form whose elements reside in a table.
Is it relevant? Why? Why don't you post a URL?
I want to
present a "Submit" and "Cancel" button
Virtually all "Cancel" buttons are worse than useless. They hardly help
the user, but often cause serious damage.
at the bottom each of which
have a different destination.
I think we now all guess the context and "purpose" of those buttons.
This is of course easy to do if you
either a) use javascript on a button or b) go to the dark side and
put a form within a table.
What's dark about b)? All the rest is dark, though.
I would like to avoid these two
techniques if possible. Any ideas?


If you have something that actually submits some data to some
processing, redesign the form. If not, remove the form. If problems
remain, post the URL or, if you want quick help, check the FAQ.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #2


M2 wrote:
Hi,
a have a single form whose elements reside in a table. I want to present a
"Submit" and "Cancel" button at the bottom each of which have a different
destination. This is of course easy to do if you either a) use javascript on
a button or b) go to the dark side and put a form within a table. I would
like to avoid these two techniques if possible. Any ideas?


Here's a possible solution:
have two different "submit" buttons, with different names. On the CGI
side, check for the existence of the variable <name> (you do this
differently if you use GET or POST). Here's an example using PHP:

<form name="myform" method="POST" action"http://url/post.php">
<input type="text" name="information">
<input type="submit" name="submit_ok" value="Submit">
<input type="submit" name="submit_cancel" value="Cancel">
</form>

And here is post.php:

<?

if (isset($_POST["submit_ok"]))
{
// process SUBMIT
}
else if (isset($_POST["submit_cancel"]))
{
// process cancel
}

?>

I haven't tested this though but it should work.

--
luc wastiaux - email: du*******@airpost.net
Jul 20 '05 #3
M2
> Here's a possible solution:
have two different "submit" buttons, with different names. On the CGI
side, check for the existence of the variable <name> (you do this
differently if you use GET or POST). Here's an example using PHP:


Thanks I hadn't thought of that, makes sense though.

Matt.
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Daniel | last post: by
3 posts views Thread by Christian | last post: by
5 posts views Thread by W.Sh | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.