HTML contact form in PHP block -


i'm relatively new php forgive me if seems obvious. how integrate block of html code this:

 <form action="form.php" method="post" enctype="multipart/form-data">          <label></label>         <input name="name" required="required" placeholder="your name">           <label></label>         <input name="email" type="email" required="required" placeholder="your email">              <label></label>         <input name="address" type="name" required="required" placeholder="your address">           <label></label>         <textarea name="message" required > dear mr. x, please support us...  </textarea>           <input id="cancel" name="cancel" value="cancel" />          <input id="submit" name="submit" type="submit" value="submit">      </form> 

into here:

if(empty($mpemail)){  echo "<h2>send mp our pre-written letter</h2> <p>unfortunately, mp's email address not listed in our database.</p>"; }  else {  echo "<h2>send mp our pre-written letter</h2>"; echo "<p>please fill out information required below:</p>";      **insert contact form here** echo "<h2>share followers!</h2>"; echo '<a href="https://twitter.com/share" class="twitter-share-button"          data-text="i used eg4demuk\'s handy tool write local mp egypt!" data-size="large" data-hashtags="writetoyourmp">tweet </a>'; echo "<script>!function(d,s,id){var js,fjs=d.getelementsbytagname(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getelementbyid(id)){js=d.createelement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentnode.insertbefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>"; } 

thanks in advance help.

so, 1 option echo out line line, php code sample doing, or in 1 big block. can combine php , html in same file starting , stopping php interpreter. here's example of that:

if (empty($mpemail)) {     echo "<h2>send mp our pre-written letter</h2>     <p>unfortunately, mp's email address not listed in our database.</p>"; } else { ?>  <h2>send mp our pre-written letter</h2> <p>please fill out information required below:</p>  <form action="form.php" method="post" enctype="multipart/form-data">     <label></label>     <input name="name" required="required" placeholder="your name">      <label></label>     <input name="email" type="email" required="required" placeholder="your email">      <label></label>     <input name="address" type="name" required="required" placeholder="your address">       <label></label>     <textarea name="message" required > dear mr. x, please support us...  </textarea>      <input id="cancel" name="cancel" value="cancel" />     <input id="submit" name="submit" type="submit" value="submit"> </form>   <h2>share followers!</h2> <a href="https://twitter.com/share" class="twitter-share-button" data-text="i used eg4demuk\'s handy tool write local mp egypt!" data-size="large" data-hashtags="writetoyourmp">tweet </a>  <script>!function(d,s,id){var js,fjs=d.getelementsbytagname(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getelementbyid(id)){js=d.createelement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentnode.insertbefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>  <?php } 

in professional production application, "right way" separate html php putting logic of application in separate php file, , putting html in "template" load , display php. here bit of info getting started template engines , model view controller patterns in application. but, you're trying do, example above of starting , stopping interpreter should work you.


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -