"send to a friend" script

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shybe

    "send to a friend" script

    Ok,

    Im trying to create a "send this article to a friend" script for my
    blog,

    Right now its sending all the articles,

    but I want it to only send the article in which the form is attached
    to.

    here is my code:

    <?php
    $to_email = $_POST['maily'];
    $art = $GLOBALS['thisarticle']['thisid'];
    $submitted = $_POST['submitted'][$art];
    $suby = $_POST['submitted'];
    $from_email = $_POST['from'];
    $subject = 'yeah';
    $headers = "From:{$from_em ail}" ;
    $message = 'You have been sent a story from The Trumpet
    Group'."\n".' http://www.trumpetgrou p.com/index.php?id='. $GLOBALS['thisarticle']['thisid'].'.com';


    echo $submitted;

    if($submitted)
    {
    mail($to_email, $subject, $message, $headers );
    echo "This story has been sent";
    }

    ?>

    here is my form:

    <form method="post" action="<?php $_SERVER['PHP SELF'];?>">
    From: <input class="putty" type="text" name="from">
    To: <input class="putty" type="text" name="maily">
    <input class="send" type="submit" name="submitted <txp:article_ id />">
    </form>

    Any help would be appreciated

    thanks in advanced,
    shybe
  • Jerry Stuckle

    #2
    Re: &quot;send to a friend&quot; script

    shybe wrote:
    Ok,
    >
    Im trying to create a "send this article to a friend" script for my
    blog,
    >
    Right now its sending all the articles,
    >
    but I want it to only send the article in which the form is attached
    to.
    >
    here is my code:
    >
    <?php
    $to_email = $_POST['maily'];
    $art = $GLOBALS['thisarticle']['thisid'];
    $submitted = $_POST['submitted'][$art];
    $suby = $_POST['submitted'];
    $from_email = $_POST['from'];
    $subject = 'yeah';
    $headers = "From:{$from_em ail}" ;
    $message = 'You have been sent a story from The Trumpet
    Group'."\n".' http://www.trumpetgrou p.com/index.php?id='. $GLOBALS['thisarticle']['thisid'].'.com';
    >
    >
    echo $submitted;
    >
    if($submitted)
    {
    mail($to_email, $subject, $message, $headers );
    echo "This story has been sent";
    }
    >
    ?>
    >
    here is my form:
    >
    <form method="post" action="<?php $_SERVER['PHP SELF'];?>">
    From: <input class="putty" type="text" name="from">
    To: <input class="putty" type="text" name="maily">
    <input class="send" type="submit" name="submitted <txp:article_ id />">
    </form>
    >
    Any help would be appreciated
    >
    thanks in advanced,
    shybe
    >
    How is your $GLOBALS array getting set? What to you get if your
    print_r($GLOBAL S); ?

    Do you actually want a '.com' extension on the article? (Maybe so, but
    it's quite unusual).

    P.S. It's generally poor form to use globals any more than necessary.

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • shybe

      #3
      Re: &quot;send to a friend&quot; script

      On Nov 28, 4:03 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
      shybe wrote:
      Ok,
      >
      Im trying to create a "send this article to a friend" script for my
      blog,
      >
      Right now its sending all the articles,
      >
      but I want it to only send the article in which the form is attached
      to.
      >
      here is my code:
      >
      <?php
      $to_email = $_POST['maily'];
      $art = $GLOBALS['thisarticle']['thisid'];
      $submitted = $_POST['submitted'][$art];
      $suby = $_POST['submitted'];
      $from_email = $_POST['from'];
      $subject = 'yeah';
      $headers = "From:{$from_em ail}" ;
      $message = 'You have been sent a story from The Trumpet
      Group'."\n".'ht tp://www.trumpetgrou p.com/index.php?id='. $GLOBALS['thisarticle']['thisid'].'.com';
      >
      echo $submitted;
      >
      if($submitted)
      {
      mail($to_email, $subject, $message, $headers );
      echo "This story has been sent";
      }
      >
      ?>
      >
      here is my form:
      >
      <form method="post" action="<?php $_SERVER['PHP SELF'];?>">
      From: <input class="putty" type="text" name="from">
      To: <input class="putty" type="text" name="maily">
      <input class="send" type="submit" name="submitted <txp:article_ id />">
      </form>
      >
      Any help would be appreciated
      >
      thanks in advanced,
      shybe
      >
      How is your $GLOBALS array getting set? What to you get if your
      print_r($GLOBAL S); ?
      Thanks for responding,

      the Globals variable is actually a variable provided by Textpattern,
      which is what I'm using for my CMS.
      I usually use it to grab the current articles ID, and it works in that
      regard, but the problem is my script is grabbing all the article IDs
      from the homepage.

      As for the .COM its just a typo on my part.

      Thanks again for your time.

      >
      Do you actually want a '.com' extension on the article? (Maybe so, but
      it's quite unusual).
      >
      P.S. It's generally poor form to use globals any more than necessary.
      >
      --
      =============== ===
      Remove the "x" from my email address
      Jerry Stuckle
      JDS Computer Training Corp.
      jstuck...@attgl obal.net
      =============== ===

      Comment

      • Jerry Stuckle

        #4
        Re: &quot;send to a friend&quot; script

        shybe wrote:
        On Nov 28, 4:03 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
        >shybe wrote:
        >>Ok,
        >>Im trying to create a "send this article to a friend" script for my
        >>blog,
        >>Right now its sending all the articles,
        >>but I want it to only send the article in which the form is attached
        >>to.
        >>here is my code:
        >><?php
        >>$to_email = $_POST['maily'];
        >>$art = $GLOBALS['thisarticle']['thisid'];
        >>$submitted = $_POST['submitted'][$art];
        >>$suby = $_POST['submitted'];
        >>$from_email = $_POST['from'];
        >>$subject = 'yeah';
        >>$headers = "From:{$from_em ail}" ;
        >>$message = 'You have been sent a story from The Trumpet
        >>Group'."\n".' http://www.trumpetgrou p.com/index.php?id='. $GLOBALS['thisarticle']['thisid'].'.com';
        >>echo $submitted;
        >>if($submitted )
        >>{
        >>mail($to_emai l, $subject, $message, $headers );
        >>echo "This story has been sent";
        >>}
        >>?>
        >>here is my form:
        >><form method="post" action="<?php $_SERVER['PHP SELF'];?>">
        >>From: <input class="putty" type="text" name="from">
        >>To: <input class="putty" type="text" name="maily">
        >><input class="send" type="submit" name="submitted <txp:article_ id />">
        >></form>
        >>Any help would be appreciated
        >>thanks in advanced,
        >>shybe
        >How is your $GLOBALS array getting set? What to you get if your
        >print_r($GLOBA LS); ?
        Thanks for responding,
        >
        the Globals variable is actually a variable provided by Textpattern,
        which is what I'm using for my CMS.
        I usually use it to grab the current articles ID, and it works in that
        regard, but the problem is my script is grabbing all the article IDs
        from the homepage.
        >
        As for the .COM its just a typo on my part.
        >
        Thanks again for your time.
        >
        >
        >Do you actually want a '.com' extension on the article? (Maybe so, but
        >it's quite unusual).
        >>
        >P.S. It's generally poor form to use globals any more than necessary.
        >>
        >--
        >============== ====
        >Remove the "x" from my email address
        >Jerry Stuckle
        >JDS Computer Training Corp.
        >jstuck...@attg lobal.net
        >============== ====
        >
        >
        Ok, so what's in $GLOBALS['thisarticle']['thisid'] (try
        print_r($GLOBAL S); to be sure).

        And what exactly do you get in your email?

        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        Working...