7 Replies Latest reply on May 14, 2006 5:42 AM by Newsgroup_User

    PHP Question - probably "oh-so" simple...

    Level 7
      I'm inputting the user's IP address into a disabled field on a contact form,
      like so:

      <input disabled ... value="<?php $ip= $_SERVER['REMOTE_ADDR']; echo $ip;?>">

      I want to have that address e-mailed to me - but I haven't been mailing
      strings before. This is how everything else is getting inserted into the
      message:

      $Message .= "E-mail Address: ".$_POST['email']."\r\n";

      How can I send the $ip in the message, too?

      --
      Shane H
      shane@NOSPAMavenuedesigners.com
      http://www.avenuedesigners.com


        • 1. Re: PHP Question - probably &quot;oh-so&quot; simple...
          Level 7
          Shane H wrote:
          > This is how everything else is getting inserted into the
          > message:
          >
          > $Message .= "E-mail Address: ".$_POST['email']."\r\n";
          >
          > How can I send the $ip in the message, too?

          It's not $ip that you put in the message, but whatever name you have
          given to that particular field. Say you have called it "ip", like this:

          <input name="ip" .... />

          The you get the value from $_POST['ip'].

          $Message .= "IP Address: ".$_POST['ip']."\r\n";

          --
          David Powers
          Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
          Author, "Foundation PHP 5 for Flash" (friends of ED)
          http://foundationphp.com/
          • 2. Re: PHP Question - probably &quot;oh-so&quot; simple...
            Level 7
            I should have mentioned that I did infact try that, and it comes up in the
            e-mail as:

            IP Address:

            Here is the code for the input field:

            <label for="ipaddress" class="labelbold">IP Address <span
            class="redast">*</span></label><br>
            <input disabled name="ipaddress" type="text" class="phonefield"
            id="ipaddress" value="<?php $ip= $_SERVER['REMOTE_ADDR']; echo $ip;?>"
            style="color: #000000">

            And here is the "adding to the e-mail code:

            $Message .= "IP Address: ".$_POST['ipaddress']."\r\n";

            Any suggestions on why it's getting a blank field e-mailed to me?

            --
            Shane H
            shane@NOSPAMavenuedesigners.com
            http://www.avenuedesigners.com


            "David Powers" <david@example.com> wrote in message
            news:e45cg2$kbt$1@forums.macromedia.com...
            > Shane H wrote:
            >> This is how everything else is getting inserted into the message:
            >>
            >> $Message .= "E-mail Address: ".$_POST['email']."\r\n";
            >>
            >> How can I send the $ip in the message, too?
            >
            > It's not $ip that you put in the message, but whatever name you have given
            > to that particular field. Say you have called it "ip", like this:
            >
            > <input name="ip" .... />
            >
            > The you get the value from $_POST['ip'].
            >
            > $Message .= "IP Address: ".$_POST['ip']."\r\n";
            >
            > --
            > David Powers
            > Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
            > Author, "Foundation PHP 5 for Flash" (friends of ED)
            > http://foundationphp.com/


            • 3. Re: PHP Question - probably &quot;oh-so&quot; simple...
              Level 7
              The IP address will probably only be one from a block owned by the ISP, you
              know?

              --
              Murray --- ICQ 71997575
              Adobe Community Expert
              (If you *MUST* email me, don't LAUGH when you do so!)
              ==================
              http://www.dreamweavermx-templates.com - Template Triage!
              http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
              http://www.dwfaq.com - DW FAQs, Tutorials & Resources
              http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
              ==================


              "Shane H" <shane@NOSPAMavenuedesigners.com> wrote in message
              news:e45csv$l1c$1@forums.macromedia.com...
              >I should have mentioned that I did infact try that, and it comes up in the
              >e-mail as:
              >
              > IP Address:
              >
              > Here is the code for the input field:
              >
              > <label for="ipaddress" class="labelbold">IP Address <span
              > class="redast">*</span></label><br>
              > <input disabled name="ipaddress" type="text" class="phonefield"
              > id="ipaddress" value="<?php $ip= $_SERVER['REMOTE_ADDR']; echo $ip;?>"
              > style="color: #000000">
              >
              > And here is the "adding to the e-mail code:
              >
              > $Message .= "IP Address: ".$_POST['ipaddress']."\r\n";
              >
              > Any suggestions on why it's getting a blank field e-mailed to me?
              >
              > --
              > Shane H
              > shane@NOSPAMavenuedesigners.com
              > http://www.avenuedesigners.com
              >
              >
              > "David Powers" <david@example.com> wrote in message
              > news:e45cg2$kbt$1@forums.macromedia.com...
              >> Shane H wrote:
              >>> This is how everything else is getting inserted into the message:
              >>>
              >>> $Message .= "E-mail Address: ".$_POST['email']."\r\n";
              >>>
              >>> How can I send the $ip in the message, too?
              >>
              >> It's not $ip that you put in the message, but whatever name you have
              >> given to that particular field. Say you have called it "ip", like this:
              >>
              >> <input name="ip" .... />
              >>
              >> The you get the value from $_POST['ip'].
              >>
              >> $Message .= "IP Address: ".$_POST['ip']."\r\n";
              >>
              >> --
              >> David Powers
              >> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
              >> Author, "Foundation PHP 5 for Flash" (friends of ED)
              >> http://foundationphp.com/
              >
              >


              • 4. Re: PHP Question - probably &quot;oh-so&quot; simple...
                Level 7
                Shane H wrote:
                > <input disabled name="ipaddress" type="text" class="phonefield"
                > id="ipaddress" value="<?php $ip= $_SERVER['REMOTE_ADDR']; echo $ip;?>"
                > style="color: #000000">
                >
                > Any suggestions on why it's getting a blank field e-mailed to me?

                Because you have disabled the field. Use readonly instead.

                --
                David Powers
                Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
                Author, "Foundation PHP 5 for Flash" (friends of ED)
                http://foundationphp.com/
                • 5. Re: PHP Question - probably &quot;oh-so&quot; simple...
                  Level 7
                  Huh?

                  --
                  Shane H
                  shane@NOSPAMavenuedesigners.com
                  http://www.avenuedesigners.com


                  "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
                  news:e45g99$oqn$1@forums.macromedia.com...
                  > The IP address will probably only be one from a block owned by the ISP,
                  > you know?
                  >
                  > --
                  > Murray --- ICQ 71997575
                  > Adobe Community Expert
                  > (If you *MUST* email me, don't LAUGH when you do so!)
                  > ==================
                  > http://www.dreamweavermx-templates.com - Template Triage!
                  > http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                  > http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                  > http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
                  > ==================
                  >
                  >
                  > "Shane H" <shane@NOSPAMavenuedesigners.com> wrote in message
                  > news:e45csv$l1c$1@forums.macromedia.com...
                  >>I should have mentioned that I did infact try that, and it comes up in the
                  >>e-mail as:
                  >>
                  >> IP Address:
                  >>
                  >> Here is the code for the input field:
                  >>
                  >> <label for="ipaddress" class="labelbold">IP Address <span
                  >> class="redast">*</span></label><br>
                  >> <input disabled name="ipaddress" type="text" class="phonefield"
                  >> id="ipaddress" value="<?php $ip= $_SERVER['REMOTE_ADDR']; echo $ip;?>"
                  >> style="color: #000000">
                  >>
                  >> And here is the "adding to the e-mail code:
                  >>
                  >> $Message .= "IP Address: ".$_POST['ipaddress']."\r\n";
                  >>
                  >> Any suggestions on why it's getting a blank field e-mailed to me?
                  >>
                  >> --
                  >> Shane H
                  >> shane@NOSPAMavenuedesigners.com
                  >> http://www.avenuedesigners.com
                  >>
                  >>
                  >> "David Powers" <david@example.com> wrote in message
                  >> news:e45cg2$kbt$1@forums.macromedia.com...
                  >>> Shane H wrote:
                  >>>> This is how everything else is getting inserted into the message:
                  >>>>
                  >>>> $Message .= "E-mail Address: ".$_POST['email']."\r\n";
                  >>>>
                  >>>> How can I send the $ip in the message, too?
                  >>>
                  >>> It's not $ip that you put in the message, but whatever name you have
                  >>> given to that particular field. Say you have called it "ip", like this:
                  >>>
                  >>> <input name="ip" .... />
                  >>>
                  >>> The you get the value from $_POST['ip'].
                  >>>
                  >>> $Message .= "IP Address: ".$_POST['ip']."\r\n";
                  >>>
                  >>> --
                  >>> David Powers
                  >>> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
                  >>> Author, "Foundation PHP 5 for Flash" (friends of ED)
                  >>> http://foundationphp.com/
                  >>
                  >>
                  >
                  >


                  • 6. Re: PHP Question - probably &quot;oh-so&quot; simple...
                    Level 7
                    That's it - thank you David, works great now!

                    --
                    Shane H
                    shane@NOSPAMavenuedesigners.com
                    http://www.avenuedesigners.com


                    "David Powers" <david@example.com> wrote in message
                    news:e45ja9$s23$1@forums.macromedia.com...
                    > Shane H wrote:
                    >> <input disabled name="ipaddress" type="text" class="phonefield"
                    >> id="ipaddress" value="<?php $ip= $_SERVER['REMOTE_ADDR']; echo $ip;?>"
                    >> style="color: #000000">
                    >>
                    >> Any suggestions on why it's getting a blank field e-mailed to me?
                    >
                    > Because you have disabled the field. Use readonly instead.
                    >
                    > --
                    > David Powers
                    > Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
                    > Author, "Foundation PHP 5 for Flash" (friends of ED)
                    > http://foundationphp.com/


                    • 7. Re: PHP Question - probably &quot;oh-so&quot; simple...
                      Level 7
                      I mean that you will probably only get the ISP's IP address block, not
                      anything specific to the user (unless the user has a static IP).

                      --
                      Murray --- ICQ 71997575
                      Adobe Community Expert
                      (If you *MUST* email me, don't LAUGH when you do so!)
                      ==================
                      http://www.dreamweavermx-templates.com - Template Triage!
                      http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                      http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                      http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
                      ==================


                      "Shane H" <shane@NOSPAMavenuedesigners.com> wrote in message
                      news:e467hs$jvp$1@forums.macromedia.com...
                      > Huh?
                      >
                      > --
                      > Shane H
                      > shane@NOSPAMavenuedesigners.com
                      > http://www.avenuedesigners.com
                      >
                      >
                      > "Murray *ACE*" <forums@HAHAgreat-web-sights.com> wrote in message
                      > news:e45g99$oqn$1@forums.macromedia.com...
                      >> The IP address will probably only be one from a block owned by the ISP,
                      >> you know?
                      >>
                      >> --
                      >> Murray --- ICQ 71997575
                      >> Adobe Community Expert
                      >> (If you *MUST* email me, don't LAUGH when you do so!)
                      >> ==================
                      >> http://www.dreamweavermx-templates.com - Template Triage!
                      >> http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
                      >> http://www.dwfaq.com - DW FAQs, Tutorials & Resources
                      >> http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
                      >> ==================
                      >>
                      >>
                      >> "Shane H" <shane@NOSPAMavenuedesigners.com> wrote in message
                      >> news:e45csv$l1c$1@forums.macromedia.com...
                      >>>I should have mentioned that I did infact try that, and it comes up in
                      >>>the e-mail as:
                      >>>
                      >>> IP Address:
                      >>>
                      >>> Here is the code for the input field:
                      >>>
                      >>> <label for="ipaddress" class="labelbold">IP Address <span
                      >>> class="redast">*</span></label><br>
                      >>> <input disabled name="ipaddress" type="text" class="phonefield"
                      >>> id="ipaddress" value="<?php $ip= $_SERVER['REMOTE_ADDR']; echo $ip;?>"
                      >>> style="color: #000000">
                      >>>
                      >>> And here is the "adding to the e-mail code:
                      >>>
                      >>> $Message .= "IP Address: ".$_POST['ipaddress']."\r\n";
                      >>>
                      >>> Any suggestions on why it's getting a blank field e-mailed to me?
                      >>>
                      >>> --
                      >>> Shane H
                      >>> shane@NOSPAMavenuedesigners.com
                      >>> http://www.avenuedesigners.com
                      >>>
                      >>>
                      >>> "David Powers" <david@example.com> wrote in message
                      >>> news:e45cg2$kbt$1@forums.macromedia.com...
                      >>>> Shane H wrote:
                      >>>>> This is how everything else is getting inserted into the message:
                      >>>>>
                      >>>>> $Message .= "E-mail Address: ".$_POST['email']."\r\n";
                      >>>>>
                      >>>>> How can I send the $ip in the message, too?
                      >>>>
                      >>>> It's not $ip that you put in the message, but whatever name you have
                      >>>> given to that particular field. Say you have called it "ip", like this:
                      >>>>
                      >>>> <input name="ip" .... />
                      >>>>
                      >>>> The you get the value from $_POST['ip'].
                      >>>>
                      >>>> $Message .= "IP Address: ".$_POST['ip']."\r\n";
                      >>>>
                      >>>> --
                      >>>> David Powers
                      >>>> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
                      >>>> Author, "Foundation PHP 5 for Flash" (friends of ED)
                      >>>> http://foundationphp.com/
                      >>>
                      >>>
                      >>
                      >>
                      >
                      >