Results 1 to 8 of 8

Thread: php & javascript mission

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    11

    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

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    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 */

    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    11

    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

  4. #4
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    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.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  5. #5

    Thread Starter
    New Member
    Join Date
    May 2007
    Posts
    11

    Re: php & javascript mission

    i think that u r wrong why should i spend resources if i can do it on the client side?:-)

  6. #6
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    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.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  7. #7
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: php & javascript mission

    Quote 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.

  8. #8
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    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
  •  



Click Here to Expand Forum to Full Width