|
|
Author |
Thread |
Wakkos
Maniac (V) Mad Scientist
From: Azylum's Secret Lab Insane since: Oct 2000
|
posted 07-30-2002 11:14
Hello!
This could belong to JS, not sure, feel free to move it:
I have this PHP DB queri that prints a checkbox per register (thanks Emps) I want to have several buttoms on the bottom of the page to elete the selected, add them, edit them, etc...
But I have no clue on how to assign a variable value to each one!
Beacause I have this page to process where a select makes all the work depending on a variable (thanks mr.maX) so I want to assign a value to that variable, depending on which submit buttom you make click.
Or there's another easier way?
|
InI
Paranoid (IV) Mad Scientist
From: Somewhere over the rainbow Insane since: Mar 2001
|
posted 07-30-2002 11:39
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
|
Wakkos
Maniac (V) Mad Scientist
From: Azylum's Secret Lab Insane since: Oct 2000
|
posted 07-30-2002 12:05
Hummm, let's make for now the easy way:
<INPUT type=radio name=radiecito value=aceptodas>Borrar<BR>
<INPUT type=radio name=radiecito value=denegada>aceptar<BR>
<INPUT TYPE=submit VALUE=ingresar></form>
And the I need to change the switch select, right?
to something like this:
switch(radiecito) {
case "denegada":
blah blah
break;
case "aceptodas":
more blah
}
*runs naked to test*
|
GRUMBLE
Paranoid (IV) Mad Scientist
From: Omicron Persei 8 Insane since: Oct 2000
|
posted 07-30-2002 12:11
or you make a several form for each entry.
|
InI
Paranoid (IV) Mad Scientist
From: Somewhere over the rainbow Insane since: Mar 2001
|
posted 07-30-2002 12:18
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
|
Wakkos
Maniac (V) Mad Scientist
From: Azylum's Secret Lab Insane since: Oct 2000
|
posted 07-30-2002 12:22
To do that Grumble, I'll need to make a click for every entry, and they are nearly 1000 every day. =)
And nop, it's not working, it returns the 'default' of the select.
I think that switch(radiecito) it's not the appropiated variable to use, should be that the name of the radio buttom?
[This message has been edited by Wakkos (edited 07-30-2002).]
|
InI
Paranoid (IV) Mad Scientist
From: Somewhere over the rainbow Insane since: Mar 2001
|
posted 07-30-2002 12:26
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
|
Wakkos
Maniac (V) Mad Scientist
From: Azylum's Secret Lab Insane since: Oct 2000
|
posted 07-30-2002 12:31
Yep i tried $radiecito and didn't work, but now I received the variable like this:
$var = $_POST["radiecito"];
and then:
switch ($var) {
blah lah
}
and works!!
thank you very much!!!!!
And just because you helped me:
*Wakkos dress some shoes now*
[This message has been edited by Wakkos (edited 07-30-2002).]
|
InI
Paranoid (IV) Mad Scientist
From: Somewhere over the rainbow Insane since: Mar 2001
|
posted 07-30-2002 12:32
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
|
GRUMBLE
Paranoid (IV) Mad Scientist
From: Omicron Persei 8 Insane since: Oct 2000
|
posted 07-30-2002 12:34
oh, sorry. i misunderstood your question.
so, your problem are the "select all" "select none" buttons at the bottom? so this is more a JS question that SSS. right?
|
Wakkos
Maniac (V) Mad Scientist
From: Azylum's Secret Lab Insane since: Oct 2000
|
posted 07-30-2002 12:38
We could say that! but, since I'm using PHP variables to get it
What I want it's exactly print a DB query and a check box with each one, then, make an action with the checkeds one only: delete, upgrade, whatever...
Only one buttom to process all the checked. If not, I would have to submit the form for each register!
Feel free to move it! could help to other in its respective forum!!!
|
stinx
Bipolar (III) Inmate
From: London, UK Insane since: Apr 2002
|
posted 07-30-2002 17:21
Call me simple, but a normal submit button will get passed as a name/value pair as long as you give it a name...
code:
<input type="submit" name="do_this" value="Add"/>
<input type="submit" name="do_this" value="Delete"/>
<input type="submit" name="do_this" value="Edit"/>
This should result in a variable of $do_this which will contain the string value of whichever button was clicked, e.g. $do_this = "Add" or $do_this="Edit"
The only problem is that if the form is submitted by pressing enter on a text field, the $do_this value won't be passed (no button was clicked on). You can get around this by adding onClick="clicked=1;" within the submit buttons, and having onSubmit="return(clicked);" in the form tag.
|
InI
Paranoid (IV) Mad Scientist
From: Somewhere over the rainbow Insane since: Mar 2001
|
posted 07-30-2002 17:31
The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.
|
Emperor
Maniac (V) Mad Scientist with Finglongers
From: Cell 53, East Wing Insane since: Jul 2001
|
posted 07-30-2002 22:47
Wakkos: What I was getting at here:
www.gurusnetwork.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic;f=20;t=000053
was something like stinx has said:
code:
if ($add) {
DO ADD STUFF
}
if ($edit) {
DO EDIT STUFF
}
if ($delete) {
DO DELETE STUFF
}
else {
<form action="$PHP_SELF" method="post">
CHECKBOXES
<input type="submit" name="add" value="Add" />
<input type="submit" name="edit" value="Edit" />
<input type="submit" name="delete" value="Delete" />
</form>
}
Is that what you need or are you looking for something more complex?
___________________
Emps
FAQs: Emperor
|
Wakkos
Maniac (V) Mad Scientist
From: Azylum's Secret Lab Insane since: Oct 2000
|
posted 07-31-2002 08:45
Nah Emps! Now I'm perfect!!
Here and there I found all what I needed (except a girlfriend)
*Runs naked to his cell*
|
Raptor
Paranoid (IV) Inmate
From: AČ, MI, USA Insane since: Nov 2001
|
posted 08-03-2002 05:25
And some clothes.. would somebody grab this man a tube sock or something?!
|