|
-
May 27th, 2007, 01:06 AM
#1
Thread Starter
New Member
php & javascript mission
i want to know how do i approch to solve a mission that i have
example:i have to submit a form with a textbox and 2 submit buttons as images i have to know which button was pressed. in example "delete" and "update"
how do i approch that where do i begin? what do i have to think of first or last,do i have to scatch an algorithm?
what should i do?
It's very importent to me to know this from someone who has alot of expirience cause i thik if i'll know the solutions for my dilemas i will succed
thanx
-
May 27th, 2007, 02:13 PM
#2
Re: php & javascript mission
If you give each submit button a different name you can check which one was pressed using the isset function:
PHP Code:
if (isset($_POST['delete'])) {
/* do delete */
} else if (isset($_POST['change'])) {
/* do change */
}
-
May 28th, 2007, 04:14 AM
#3
Thread Starter
New Member
Re: php & javascript mission
Ok Thanks I Assume That U Don't Have An Answer How To Do It Only With Js.
And What About My Other Section Of The Question?
Tnx
-
May 28th, 2007, 04:28 AM
#4
Re: php & javascript mission
And the other part to your question is? This is the PHP forum but why use Javascript to deal with a submitted form? The whole point of submitting the form is to send the data back to the server.
-
May 28th, 2007, 01:29 PM
#5
Thread Starter
New Member
Re: php & javascript mission
i think that u r wrong why should i spend resources if i can do it on the client side?:-)
-
May 28th, 2007, 02:36 PM
#6
Re: php & javascript mission
Do what exactly, on the client side. It's very hard to get things right when you are being so vague.
-
May 28th, 2007, 07:47 PM
#7
Re: php & javascript mission
 Originally Posted by itaisass
i think that u r wrong why should i spend resources if i can do it on the client side?:-)
you can create 2 forms using javascript with different actions.
have each button have an onClick event (or use an event handler which is the better way) and call a different function based on which button is pressed. Inside the function you can call the submit function of each form separately.
-
May 29th, 2007, 11:26 AM
#8
Re: php & javascript mission
... and then your website will be absolutely useless to anyone who has javascript disabled.
either way, if you're not looking for a PHP solution, why did you post this in the PHP forums? we don't take kindly to doing things on the client side around these parts.
javascript forum
Last edited by kows; May 29th, 2007 at 11:29 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|