Form Woes

L

Leon

Hi Chaps,

I have been looking around the internet and I really can't see what I'm
doing wrong here !

This code works in firefox, but not internet explorer.

Any suggestions please? Internet Explorer just doesnt update the action
of the form so when you hit the button - it seemingly just refrehes the
page!

<form name="actions" action="" method="post">
<select name="action" class="formBox">
<option value="null" onclick="this.form.action.value='';">Select Action
From List
<option value="resendActEmail"
onclick="this.form.action.value='./admin_process.php?a=resend';">Re-Send
Activation Email
<option value="deletaccount"
onclick="this.form.action.value='./admin_process.php?a=delete';">Delete
This Account
</select>
<input class="formBox" type="submit" name="submit" value="Go">
</form>

Thanks,

Leon
 
J

Jonathan N. Little

Leon said:
Hi Chaps,

I have been looking around the internet and I really can't see what I'm
doing wrong here !

This code works in firefox, but not internet explorer.

Any suggestions please? Internet Explorer just doesnt update the action
of the form so when you hit the button - it seemingly just refrehes the
page!

<form name="actions" action="" method="post">
<select name="action" class="formBox">
<option value="null" onclick="this.form.action.value='';">Select Action
From List
<option value="resendActEmail"
onclick="this.form.action.value='./admin_process.php?a=resend';">Re-Send
Activation Email
<option value="deletaccount"
onclick="this.form.action.value='./admin_process.php?a=delete';">Delete
This Account
</select>
<input class="formBox" type="submit" name="submit" value="Go">
</form>

No, no do not set the action with JavaScript. Looks like your want an
either or option use a radio button and set the form destination in the
ACTION attribute:

<form action="./admin_process.php" method="post">

....

<fieldset>
<legend>Account Action</legend>
<input type="hidden" name="b" value="zoom">
<input name="a" id="resendIt" type="radio" value="resend" checked>
<label for="resendIt">Re-Send Activation</label>
<input name="a" id="deleteIt" type="radio" value="delete">
<label for="deleteIt">Delete This Account</label>
<input type="submit" value="Go">
</fieldset>
</form>


Since your want POST method, not sure why you were hacking the ACTION to
add a GET query string. Now in "admin_process.php":

if(isset($_POST['a'])){
if($_POST['a']) == 'resend'){
//account resent routine
}
elseif($_POST['a']) == 'delete'){
//account delete routine
}
else {
// shouldn't happen your form's been hacked!
}
}
 
H

Harlan Messinger

Leon said:
Hi Chaps,

I have been looking around the internet and I really can't see what I'm
doing wrong here !

This code works in firefox, but not internet explorer.

Any suggestions please? Internet Explorer just doesnt update the action
of the form so when you hit the button - it seemingly just refrehes the
page!

<form name="actions" action="" method="post">
<select name="action" class="formBox">
<option value="null" onclick="this.form.action.value='';">Select Action
From List
<option value="resendActEmail"
onclick="this.form.action.value='./admin_process.php?a=resend';">Re-Send
Activation Email
<option value="deletaccount"
onclick="this.form.action.value='./admin_process.php?a=delete';">Delete
This Account
</select>
<input class="formBox" type="submit" name="submit" value="Go">
</form>

Wouldn't it be easier and clearer for your users if you skipped the form
and just had a link for each action?
 
?

=?iso-8859-1?Q?Kim_Andr=E9_Aker=F8?=

Leon said:
Hi Chaps,

I have been looking around the internet and I really can't see what
I'm doing wrong here !

This code works in firefox, but not internet explorer.

Any suggestions please? Internet Explorer just doesnt update the
action of the form so when you hit the button - it seemingly just
refrehes the page!

<form name="actions" action="" method="post">
<select name="action" class="formBox">
<option value="null" onclick="this.form.action.value='';">Select
Action From List <option value="resendActEmail"
onclick="this.form.action.value='./admin_process.php?a=resend';">Re-Se
nd Activation Email <option value="deletaccount"
onclick="this.form.action.value='./admin_process.php?a=delete';">Delet
e This Account </select> <input class="formBox" type="submit"
name="submit" value="Go"> </form>

Why would you do it this way when you can simply do it like this:

<form action="./admin_process.php" method="post">
<select name="a" class="formBox">
<option value="">Select Action From List
<option value="resend">Re-Send Activation Email
<option value="delete">Delete This Account
</select>
<input class="formBox" type="submit" name="submit" value="Go">
</form>
 
R

Rik

Why would you do it this way when you can simply do it like this:

<form action="./admin_process.php" method="post">

Euhm, GET?
<select name="a" class="formBox">
<option value="">Select Action From List
<option value="resend">Re-Send Activation Email
<option value="delete">Delete This Account
</select>
<input class="formBox" type="submit" name="submit" value="Go">
</form>

A whole lot simpler indeed. I'd prefer buttons though:
<form action="./admin_process.php" method="get">
<input type="submit" name="a" value="resend">
<input type="submit" name="a" value="delete">
</form>

Allthough it's a pity the text on the button and the actual value cannot
differ, but that's either pretty quickly solved server-side.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top