HELP! Notice: Undefined variable: ip

Forum for you who has PHP installation issues

Moderators: macek, egami, gesf

User avatar
jackdirt
New php-forum User
New php-forum User
Posts: 5
Joined: Thu Mar 10, 2005 8:18 am

HELP! Notice: Undefined variable: ip

Postby jackdirt » Thu Mar 10, 2005 8:28 am

Hi I am running winserver 2003 IIS and just installed PHP, myscripts work fine on linux servers but ont his windows box I get the Error,
Notice: Undefined variable: ip in E:\websites\prototype\sendemail.php on line 39
Oops
Notice: Undefined variable: notes in E:\websites\prototype\sendemail.php on line 45

Notice: Undefined variable: email in E:\websites\prototype\sendemail.php on line 45

Notice: Undefined variable: name in E:\websites\prototype\sendemail.php on line 45

Notice: Undefined variable: ip in E:\websites\prototype\sendemail.php on line 45

Date: Thursday, March 10, 2005, 10:22 am

Thank you for your time
Notice: Undefined variable: name in E:\websites\prototype\sendemail.php on line 61
your message has been sent.


I think I can get the code to work if i turn register_globals=On , but that is a big no no. Below is the code

Code: Select all

<?php

$myemail = "nosuchemail@test.com";
                                                     
                                                      if (!isset($email))
                                                      echo "Oops $ip" ;
                                                     
                                                      $todayis = date("l, F j, Y, g:i a") ;
                                                     
                                                      $subject = "Questions for the President" ;
                                                     
                                                      $message = " $todayis [EST] \n Message: $notes \n From: $email ($name)\n Additional Info : IP = $ip \n ";
                                                     
                                                      $from = "From: $myemail\r\n";
                                                     
                                                      if ($myemail != "")
                                                      mail($myemail, $subject, $message, $from);
                                                 
                                                  ?>
                                                 
                                                  <p align="top">
                                                     
                                        Date: <?php echo $todayis ?>
                                                     
                                        <br>
                                         <br>
                                                     
                                       Thank you for your time <?php echo $name ?> your message has been sent.
                                                     
                                       <br>
                                        <br>
                                          <a href="javascript:window:close()">Close Window</a>


Thanks ahead of time for your help

User avatar
swirlee
Moderator
Moderator
Posts: 2272
Joined: Sat Jul 05, 2003 1:18 pm
Location: A bunk in the back
Contact:

Postby swirlee » Thu Mar 10, 2005 11:09 am

With register_globals off (as it should be), you access form values using $_POST or $_GET (depending on your form method). So if you want to get the value in the email field, for example, you would use $_POST['email'].

User avatar
jackdirt
New php-forum User
New php-forum User
Posts: 5
Joined: Thu Mar 10, 2005 8:18 am

Postby jackdirt » Thu Mar 10, 2005 12:07 pm

FIrst thank you, but I should of prefaced by saying I barely know any PHP so in what instance on the script would $_POST or $GET_ go I tried replacing the $email, $notes field with it but I got
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in E:\websites\prototype\sendemail.php on line 47


Thanks Again

User avatar
WiZARD
Moderator
Moderator
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Postby WiZARD » Fri Mar 11, 2005 5:09 am

jackdirt wrote:FIrst thank you, but I should of prefaced by saying I barely know any PHP so in what instance on the script would $_POST or $GET_ go I tried replacing the $email, $notes field with it but I got
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in E:\websites\prototype\sendemail.php on line 47


Thanks Again

first: In last PHP version before you call some variable to you need declare it first. Like in C++ or Delfi.....
than you get this error: Undefined variable....
to you need firstly define this fariable......
second:
Parse error oyu get then you have a sintax error in function definition....
carefuly with quotes and what you set in function....
Good luck newbie :o)

User avatar
jackdirt
New php-forum User
New php-forum User
Posts: 5
Joined: Thu Mar 10, 2005 8:18 am

thanks

Postby jackdirt » Tue Mar 15, 2005 9:50 am

thanks i got it to work weeeeeehooo


Return to “PHP Installation”

Who is online

Users browsing this forum: No registered users and 1 guest

cron