Validation Required

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ramu528
    New Member
    • Mar 2008
    • 18

    Validation Required

    Hi friends,
    I am new to PHP. i need validations for Delete a record.

    i store a column from Database table in a tabular format. i have edit and delete option. i need to write validations confirm (yes or no to delete the record) my code goes like this::::::

    echo "<td width='68' ><a href='index2.ph p?option=com_qu alification&cid =$cid&type=dele te'> Delete</a> </td>";

    // how to write validation in the above href and where to place it. plz suggest.

    Regards,
    Ram
  • satas
    New Member
    • Nov 2007
    • 82

    #2
    Hi.
    Is it what you are looking for?

    [HTML]<a href="index2.ph p?option=com_qu alification&cid =$cid&type=dele te" onclick="return confirm('Delete item?');">Delet e</a>[/HTML]

    Comment

    • Ramu528
      New Member
      • Mar 2008
      • 18

      #3
      Originally posted by satas
      Hi.
      Is it what you are looking for?

      [HTML]<a href="index2.ph p?option=com_qu alification&cid =$cid&type=dele te" onclick="return confirm('Delete item?');">Delet e</a>[/HTML]

      hi satas,

      i am getting the error, can u correct me where i am going wrong! plz

      Parse error: syntax error, unexpected T_RETURN, expecting ',' or ';' in

      Comment

      • satas
        New Member
        • Nov 2007
        • 82

        #4
        Try this:
        [PHP]echo "<td width='68' ><a href='index2.ph p?option=com_qu alification&cid =$cid&type=dele te' onclick='return confirm(\"Delet e item?\");'> Delete</a> </td>";[/PHP]

        Comment

        • Markus
          Recognized Expert Expert
          • Jun 2007
          • 6092

          #5
          Originally posted by Ramu528
          hi satas,

          i am getting the error, can u correct me where i am going wrong! plz

          Parse error: syntax error, unexpected T_RETURN, expecting ',' or ';' in
          Ramu, how are we supposed to know where that error is? We aren't psychics.

          Post the relevant code and post the full error statement.

          Comment

          • Ramu528
            New Member
            • Mar 2008
            • 18

            #6
            Originally posted by markusn00b
            Ramu, how are we supposed to know where that error is? We aren't psychics.

            Post the relevant code and post the full error statement.
            Hi friends,

            i able correct my code with help of SAMAS. thanks samas.

            its first time, sorry, i will post my code with error from next time.
            good day.

            Comment

            • Ramu528
              New Member
              • Mar 2008
              • 18

              #7
              Originally posted by satas
              Try this:
              [PHP]echo "<td width='68' ><a href='index2.ph p?option=com_qu alification&cid =$cid&type=dele te' onclick='return confirm(\"Delet e item?\");'> Delete</a> </td>";[/PHP]
              hi satas, can we write our own validation, i mean writing function like this::

              onclick="gotode lete(row(id))";

              can u help me out here.

              with 'return confirm' i am not able to delete the record. But i am showing alert message and when pressing ok button , the page is just refreshing.

              plz satas.

              Comment

              • satas
                New Member
                • Nov 2007
                • 82

                #8
                Hi Ramu528.
                You should insert URL to some script that will delete the record.
                e.g. < a href="delrec.ph p?rowid=1">dele te</a>
                In delrec.php you should receive rowid parameter and perform necessary actions.
                After that you can return to previous page by using:
                [PHP]header("Locatio n: http://blah-blah.com/index.php");[/PHP]

                Comment

                • Ramu528
                  New Member
                  • Mar 2008
                  • 18

                  #9
                  Originally posted by satas
                  Hi Ramu528.
                  You should insert URL to some script that will delete the record.
                  e.g. < a href="delrec.ph p?rowid=1">dele te</a>
                  In delrec.php you should receive rowid parameter and perform necessary actions.
                  After that you can return to previous page by using:
                  [PHP]header("Locatio n: http://blah-blah.com/index.php");[/PHP]

                  Thanks Satas. I could complete my task with ur cooperation. thanks alot.
                  All the Best

                  Comment

                  Working...