Wie aufrufen, php Funktion aus html-form-action?

Möchte ich aufrufen, php Funktion in einem Formular Aktion und möchte ich weitergeben-id als argument. Was ich Tue, ist, im html-Formular-Datenbank-Spalte Werte werden in Textfeldern angezeigt, Wenn ich "Bearbeiten Sie diese Werte und klicken Sie auf "update' - Taste die Werte in der Datenbank aktualisiert werden soll und " Datensatz erfolgreich aktualisiert'message angezeigt werden soll, in derselben Seite. Ich habe versucht, folgenden code aber nicht funktioniert. Lassen Sie mich wissen, die Lösung. Vielen Dank im Voraus.

    <html>

    <head>

        <link rel="stylesheet" type="text/css" href="cms_style.css">        


    </head>

    <?php
        $ResumeID = $_GET['id']; 
        $con = mysql_connect("localhost", "root", "");
        mysql_select_db("engg",$con);
        $sql="SELECT * from data WHERE ResumeID=$ResumeID";
        $result = mysql_query($sql);
        $Row=mysql_fetch_row($result); 

        function updateRecord()
        {

            //If(!isset($_GET['id']))       
            //{
              $NameoftheCandidate=$_POST[NameoftheCandidate];
              $TelephoneNo=$_POST[TelephoneNo];
              $Email=$_POST[Email];

      $sql="UPDATE data SET NameoftheCandidate='$_POST[NameoftheCandidate]',         TelephoneNo='$_POST[TelephoneNo]', Email='$_POST[Email]' WHERE ResumeID=$ResumeID ";

            if(mysql_query($sql))
                echo "<p>Record updated Successfully</p>";
            else
                echo "<p>Record update failed</p>";



            while ($Row=mysql_fetch_array($result))     {
                echo ("<td>$Row[ResumeID]</td>");

                echo ("<td>$Row[NameoftheCandidate]</td>");
                echo ("<td>$Row[TelephoneNo]</td>");
                echo ("<td>$Row[Email]</td>");
            } //end of while

        } //end of update function


    ?>

    <body>
        <h2 align="center">Update the Record</h2>

        <form align="center" action="updateRecord()" method="post">
            <table align="center">
                <input type="hidden" name="resumeid" value="<? echo    "$Row[1]"?>">
            <? echo "<tr> <td> Resume ID </td>   <td>$Row[1]</td> </tr>" ?>                      

        <div align="center">
        <tr>       
        <td> Name of the Candidate</td>
    <td><input type="text" name="NameoftheCandidate" 
size="25" value="<? echo "$Row[0]"?     >"></td>
        </tr>

        <tr>
     <td>TelephoneNo</td>
    <td><input type="text" name="TelephoneNo" size="25" value="<? echo "$Row[1]"?>"></td>
     </tr>
     <tr>       
      <td>Email</td>
        <td><input type="text" name="Email" size="25" value="<? echo "$Row[3]"?>">
        </td>
    </tr>
     <tr>
    <td></td>
    <td align="center"><input type="submit" name="submitvalue" value="UPDATE" ></td>
                    </tr>
                </div>                              
            </table>
        </form>

      </body>
       </html>
bitte formatieren Sie es richtig

InformationsquelleAutor trendzcreator | 2013-03-18

Schreibe einen Kommentar