Delete Script

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jerry Stuckle

    #16
    Re: Delete Script

    mpar612 wrote:
    J.O. Aho wrote:
    >
    >>mpar612 wrote:
    >>
    >>>J.O. Aho wrote:
    >>>
    >>>>mpar612 wrote:
    >>>>
    >>>>
    >>>>>Thanks! I should have mentioned that the following is required because
    >>>>>they are being pulled form the url
    >>>>>https://www.domain.com/delete_record...&album_title=:
    >>>>
    >>>>When looking at your example you don't provide this data at all and to make
    >>>>things a lot easier I would include them into the form as hidden input-tags.
    >>>>Things gets a lot easier if you keep on sending data in the same way and not
    >>>>try to mix.
    >>>>
    >>>>
    >>> //Aho
    >>>
    >>>Thanks! Could you please elaborate a little bit more, I'm a beginner
    >>>and I don't really understand what you are saying. I don't see how I
    >>>am trying to mix the way that I am sending data.
    >>>
    >>>Thanks!
    >>>
    >>
    >>You claim you are trying to use data sent as POST and GET at the same time,
    >>thats a try in mixing, in your example you don't send anything that could be
    >>fetched with $_GET.
    >>
    >>
    >>--- send all as post ---
    >><form method="POST" action="">
    >><table>
    >>
    >><tr><td colspan="2" align="center"> Yes <?php
    >>input_radioch eck('radio','ye s_no', $defaults, 'yes'); ?No <?php
    >>input_radioch eck('radio','ye s_no', $defaults, 'no'); ?>
    >></td></tr>
    >>
    >><tr><td colspan="2" align="center"> <?php input_submit('s ave','Add'); ?>
    >></td></tr>
    >>
    >></table>
    >><input type="hidden" name="isbn" value="<?PHP echo $isbn; ?>" />
    >><input type="hidden" name="artist_na me" value="<?PHP echo $artist_name; ?>" />
    >><input type="hidden" name="album_tit le" value="<?PHP echo $album_title; ?>" />
    >><input type="hidden" name="_submit_c heck" value="1"/>
    >></form>
    >>--- end of example ---
    >>
    >>There you get all the data you needed to send, all sent as post.
    >>
    >>
    > //Aho
    >
    >
    Thanks, but I'm afraid that I don't understand why this needs to be
    done. I have variables, $isbn = $_GET['isbn'], $artist_name =
    $_GET['artist_name'] and $album_title = $_GET['album_title'] that are
    pulling information from the url:
    "www.domain .com/delete_record.p hp?isbn=1234567 689&artist_name =&album_title=. "
    >
    I want to run the delete query "DELETE FROM lounge WHERE isbn = $isbn
    AND artist_name=\'$ artist_name\' AND album_title=\'$ album_title\'.
    >
    The $_GET values work when I do a print $isbn etc... The delete query
    works in phpmyadmin when I specify hard values for isbn, artist_name
    and album_title. For example the following query works: DELETE FROM
    lounge WHERE isbn = 123456789.
    >
    These things will not work together and I'm not sure why. I believe it
    is an issue with $isbn = $_GET['isbn'], $artist_name =
    $_GET['artist_name'] and $album_title = $_GET['album_title'] and
    inserting the variable names in the SQL query, but I'm not sure how
    this works. My books don't cover this specific problem in detail.
    >
    Thank you very much for all of your help. I apologize if I'm asking
    too many questions.
    >
    As others have said - the problem is you're mixing GET and POST. You're
    POSTing the form - but then trying to use GET to retrieve the values.

    You can use one or the other - mixing both does not work well.


    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Jerry Stuckle

      #17
      Re: Delete Script

      mpar612 wrote:
      Webwasp wrote:
      >
      >>You need to start paying people here buddy. Or just give up on PHP SQL!!!
      >
      >
      These are forums and responses are voluntary. If you don't want to
      respond, then don't. Responding with comments like yours is not only
      unnecessary, but also a waste of resources and everyone's time.
      >
      And when you keep asking basic questions without trying to find the
      answer on your own, soon you'll stop getting responses to your questions.

      We are not your personal consultants! I'd suggest you try a little more
      on your own; you're quickly wearing out your welcome.

      --
      =============== ===
      Remove the "x" from my email address
      Jerry Stuckle
      JDS Computer Training Corp.
      jstucklex@attgl obal.net
      =============== ===

      Comment

      • Johnny

        #18
        Re: Delete Script


        "J.O. Aho" <user@example.n etwrote in message
        news:4k47paFak9 gkU1@individual .net...
        You can simplify your form tag, action="" is the same as calling itself,
        less
        code and less work for PHP if you use:
        >
        <form method="POST" action="">
        >
        >
        I like that shortcut :-) but I'm not confident that it will always do as you
        say.
        at w3 html4 forms

        they say
        action = uri [CT]
        This attribute specifies a form processing agent. User agent behavior for a
        value other than an HTTP URI is undefined.

        So while it may work in some browsers I'm not confident that it always will.
        Or have I missed something?

        Thanks


        Comment

        Working...