title: How to call php function from html form action?
body: <p>I want to call php function in form action and i want to pass id as a argument. What I am doing is, in html form database column values will be displayed in text boxes, If I edit those values and click 'update' button values in database should be updated and 'Record updated successfully'message should be displayed in same page. I tried below code but not working. Let me know the solution. Thanks in advance. </p>
  
  <pre><code>    &lt;html&gt;
  
      &lt;head&gt;
  
          &lt;link rel="stylesheet" type="text/css" href="cms_style.css"&gt;        
  
  
      &lt;/head&gt;
  
      &lt;?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 "&lt;p&gt;Record updated Successfully&lt;/p&gt;";
              else
                  echo "&lt;p&gt;Record update failed&lt;/p&gt;";
  
  
  
              while ($Row=mysql_fetch_array($result))     {
                  echo ("&lt;td&gt;$Row[ResumeID]&lt;/td&gt;");
  
                  echo ("&lt;td&gt;$Row[NameoftheCandidate]&lt;/td&gt;");
                  echo ("&lt;td&gt;$Row[TelephoneNo]&lt;/td&gt;");
                  echo ("&lt;td&gt;$Row[Email]&lt;/td&gt;");
              } // end of while
  
          } // end of update function
  
  
      ?&gt;
  
      &lt;body&gt;
          &lt;h2 align="center"&gt;Update the Record&lt;/h2&gt;
  
          &lt;form align="center" action="updateRecord()" method="post"&gt;
              &lt;table align="center"&gt;
                  &lt;input type="hidden" name="resumeid" value="&lt;? echo    "$Row[1]"?&gt;"&gt;
              &lt;? echo "&lt;tr&gt; &lt;td&gt; Resume ID &lt;/td&gt;   &lt;td&gt;$Row[1]&lt;/td&gt; &lt;/tr&gt;" ?&gt;                      
  
          &lt;div align="center"&gt;
          &lt;tr&gt;       
          &lt;td&gt; Name of the Candidate&lt;/td&gt;
      &lt;td&gt;&lt;input type="text" name="NameoftheCandidate" 
  size="25" value="&lt;? echo "$Row[0]"?     &gt;"&gt;&lt;/td&gt;
          &lt;/tr&gt;
  
          &lt;tr&gt;
       &lt;td&gt;TelephoneNo&lt;/td&gt;
      &lt;td&gt;&lt;input type="text" name="TelephoneNo" size="25" value="&lt;? echo "$Row[1]"?&gt;"&gt;&lt;/td&gt;
       &lt;/tr&gt;
       &lt;tr&gt;       
        &lt;td&gt;Email&lt;/td&gt;
          &lt;td&gt;&lt;input type="text" name="Email" size="25" value="&lt;? echo "$Row[3]"?&gt;"&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
       &lt;tr&gt;
      &lt;td&gt;&lt;/td&gt;
      &lt;td align="center"&gt;&lt;input type="submit" name="submitvalue" value="UPDATE" &gt;&lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/div&gt;                              
              &lt;/table&gt;
          &lt;/form&gt;
  
        &lt;/body&gt;
         &lt;/html&gt;
  </code></pre>