javascript - POST HTML textarea to PHP Variable without input -


having spent more 2 days seeking answer quandary, i'm posting question direct. there have been numerous hints , snippets of answers nothing definitively resolve issue i'm facing, hence post.

i have following script 1 specific issue, i'm unable pass content of textarea php file activated via href triggers dynamic form created.

the notion to: have variable: "comment" have textarea delivered via form accepts text , stores variable "comment". when user clicks <a href="hsl:logcall?... hyperlink, passed across updatedb.updatetxt table in database. can set text pass not variable based on textarea info...

here's html/php code:

<!doctype html>  <html> <head> <style> .error {color: #ff0000;} </style> </head> <body>   <?php // define variables , set empty values $comment = "";  if ($_server["request_method"] == "post") {     if (empty($_post["comment"])) {      $comment = "";    } else {      $comment = test_input($_post["comment"]);    } }  function test_input($data) {    $data = trim($data);    $data = stripslashes($data);    $data = htmlspecialchars($data);    return $data; } ?>  <table cellspacing="10"> <tr>     <td>     <table>     <tr>     <td>     <p>     <b>please use below start capturing call description:</b>     <form method="post">     <textarea name="comment" id="comment" rows="5" cols="45"></textarea>     </form>     </td>     <tr>     <td>  <?php $comment = $_post[comment]; // variable accept data textarea // don't need use variables, if starter, easier understand.     // arrived data...  // stupid, short explanation... example echo it... echo $comment; ?>     <a href="hsl:editrecord?formmode=edit&table=userdb&key=<?=$userdb_keysearch;?>"><img src="img/icons/call_update.gif" width="16" height="16" alt="" border="0" />edit details</a>      <a href="hsl:logcall?userdb.keysearch=<?=$userdb_keysearch;?>&updatedb.updatetxt=<?=($_post[comment]);?>"><img src="img/icons/call_detail.gif" width="16" height="16" alt="" border="0" />log new call</a>      <a href="hsl:printme"><img src="img/icons/call_print.gif" width="16" height="16" alt="" border="0" />print page</a>     </td>     </tr>     </table> </td> </tr> </table> </body> </html> 

this original unedited code

<a href="hsl:editrecord?formmode=edit&table=userdb&key=<?=$userdb_keysearch;?>"> <im‌​g src="img/icons/call_update.gif" width="16" height="16" alt="" border="0" />edit details</a>  <a href="hsl:logcall?userdb.keysearch=<?=$userdb_keysearch;?>"> <img src="img/icons/call_detail.gif" width="16" height="16" alt="" border="0" />log new call</a>  <a href="hsl:printme"><img src="img/icons/call_print.gif" width="16" height="16" alt="" border="0" />print page</a> 

you have submit form before browser take data , put in request php can read it.

you have no submit button (nor have javascript submit form). add one.


Comments