function mitsol_referral_contact_form_replace_scode() {Â Â Â
  $mrcf_html_content="";
  ob_start();
  mrcf_process_form();
  mrcf_html_form_code($mrcf_html_content);  Â
  /* Return the buffer contents into a variable */
  $msfb_html_content = ob_get_contents();
  /*Empty the buffer without displaying it. We don't want the previous html shown */
  ob_end_clean();
  /* The text returned will replace our shortcode matching text */
  return $msfb_html_content;
}
function mrcf_html_form_code($mrcf_html_content)
{Â Â Â Â Â Â Â
  $mrcf_html_content.= '<form action="' . esc_url( $_SERVER['REQUEST_URI'] ) . '" method="post">
  <!-- put all form html elements here -->Â
  <input type="submit" id="mrcf-submitted" name="mrcf-submitted" class="mrcf-input-boxes" value="Send"     </form></div>';  Â
  echo $mrcf_html_content;  Â
}
function mrcf_process_form() {
  //check if form submitted then process submitted form data Â
  if ( isset( $_POST['mrcf-submitted'] ) ) {Â
  // process submitted form data hereÂ
  }
}
Even if you know wordpress as a beginner you can understandÂ
above codes, first i defined a short code, in the shortcode functionÂ
i defined a function mrcf_html_form_code() which puts form htmlsÂ
in web page. And when form submitted, mrcf_process_form()Â
function checks if form submitted or not and processes form data.
Â
Hope you liked it, i described everything in a very simple way.Â
don't forget to share it.
Â
Â
Â