storing entries in html doc using php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aarya
    New Member
    • Sep 2005
    • 5

    storing entries in html doc using php

    How can I send variables from a details.PHP to another URL using POST without using forms. insted i need links.as i dont want to use submit button.
    after pressing that links i could see all the details
    Last edited by aarya; Sep 16 '05, 08:59 PM.
  • tommydog
    New Member
    • Sep 2006
    • 10

    #2
    Originally posted by aarya
    How can I send variables from a details.PHP to another URL using POST without using forms. insted i need links.as i dont want to use submit button.
    after pressing that links i could see all the details
    this sounds like cookies !
    try:
    what is a cookie?
    http://www.cookiecentr al.com/faq/
    using cookies with php:
    http://www.phpfreaks.c om/PHP_Reference/Session-&-Cookie/4.php

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      You can use CURL to do that. Here is a sample of it doing a POST (without form) and a sample to catch the POSTed values. You can also post from an associative array. That's another example.
      [PHP]-------------- POST variables via curl -------------
      <?php
      //
      // A very simple PHP example that sends a HTTP POST to a remote site
      //
      $ch = curl_init();
      curl_setopt($ch , CURLOPT_URL,"ht tp://www.mysite.com/tester.phtml");
      curl_setopt($ch , CURLOPT_POST, 1);
      curl_setopt($ch , CURLOPT_POSTFIE LDS,
      "postvar1=value 1&postvar2=valu e2&postvar3=val ue3");
      curl_exec ($ch);
      curl_close ($ch);
      ?>
      ------------------ and this is to test the $_POST array ---
      <?php
      echo '<h3>Form variables I received: </h3>';
      echo '<pre>';
      print_r ($_POST);
      echo '</pre>';
      ?>[/PHP]

      Ronald :cool:

      Comment

      Working...