php - $_POST links within same page -


<!doctype html> <html> <head> <meta charset="utf-8"> <title>php links</title> <?php  echo '<div style="background-color:#ccc; padding:20px">' . $_post['message'] . '</div>';  ?> <style type="text/javascript"> // prepare form when dom ready  $(document).ready(function() {      // bind form using ajaxform      $('#htmlform').ajaxform({          // target identifies element(s) update server response          target: '#htmlexampletarget',           // success identifies function invoke when server response          // has been received; here apply fade-in effect new content          success: function() {              $('#htmlexampletarget').fadein('slow');          }      });  }); </style> </head>  <body> <form id="htmlform" action="html-echo.php" method="post">          display list of links <input type="text" name="message" value="hello html" />          <input type="submit" value="submit links" />  </form> </body> </html> 

i trying results displayed on same page without having create .php page , having results displayed on separate page. it's application user can submit type of link , have results show on page.

is there way save results later reference? keep results displayed when page refreshed?

<!doctype html>  <html>   <head>   <meta charset="utf-8">    <title>php links</title>   <?php   echo '<div style="background-color:#ccc; padding:20px">' . $_post['message'] . '</div>';   ?>  <script type="text/javascript">     $(document).ready(function() {             $('#formid form').submit(function(){                     $.get('result.php', $(this).serialize(), function(data){                             $('#result').html(data);                      });                                                  return false;             });     });     </script>   </head>   <body>   <div id="formid">   <form>      display list of links <input type="text" name="message" value="hello html" />      <input type="submit" value="submit links" />       </form>      </div>       <div id="result"></div>      </body>        </html> 

try above format display form result on same page without load anotherone php file new,but should crerate result.php file generate result depend on form inputs, can values of form using $_request[''] on result.php, below sample result.php

<?php  $message=$_request['message'];  echo $message; 

?>

your generated result of result.php shows on index.php <div id="result"></div> without reload or redirect page


Comments

Popular posts from this blog

java - Why does my date parsing return a weird date? -