Current location: Hot Scripts Forums » Programming Languages » PHP » Proven PHP Script not working on Windows 2000 server – any ideas?


Proven PHP Script not working on Windows 2000 server – any ideas?

Reply
  #1 (permalink)  
Old 11-13-03, 02:24 PM
chimchim chimchim is offline
New Member
 
Join Date: Nov 2003
Location: Boston, MA
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Proven PHP Script not working on Windows 2000 server – any ideas?

Question from a somewhat newbie:

I have a simple php script that collects data from a user form, and writes it to a csv or txt file.

For example: HTML form > PHP Processing Form > Data goes into CSV file.

The php script that processes the data looks like this:

<?php

$filePointer = fopen ("mail2.csv", 'a');

fputs ($filePointer, "$userEmail".","."$state"."\n");
fclose ($filePointer);

?>

“mail2.csv” is the file I’m trying to write data to. And $userEmail and $state are the variables passed along by the form.

This script has worked great on a UNIX server running PHP 4.3.3.

THEN, I tried to use the same script and files on another website running PHP 4.3.1. and I get:

Notice : Undefined variable: userEmail in E:\Inetpub\VirtualWwwRoot\wzlxco\emailprocessstate .php on line 11

Notice : Undefined variable: state in E:\Inetpub\VirtualWwwRoot\wzlxco\emailprocessstate .php on line 11

So, I want to know if there are portability problems regarding PHP. Is there any reason why my script will work successfully on one site and not on another?

Any help would be GREATLY appreciated. Thanks in advance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 11-13-03, 04:50 PM
evo4ever evo4ever is offline
Software Developer Guru
 
Join Date: Aug 2003
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
Hi. Where are these variables getting defined? or what is giving them their values? Also, there is a special function called fgetcsv() which call handle getting data out of a CSV.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 11-13-03, 05:17 PM
chimchim chimchim is offline
New Member
 
Join Date: Nov 2003
Location: Boston, MA
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by evo4ever
Hi. Where are these variables getting defined? or what is giving them their values? Also, there is a special function called fgetcsv() which call handle getting data out of a CSV.
Well, I define the two variables (I believe?) in my html form. They get their values from the input of the user. As follows:

<form action=emailprocessstate.php>
<font face="Arial, Helvetica, sans-serif"> <font size="2">Enter your email address:
<input type="text" name="userEmail" size=10>
<br>
Enter Your State:</font>
<select name="state">
<option>AL</option>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 11-13-03, 05:23 PM
chimchim chimchim is offline
New Member
 
Join Date: Nov 2003
Location: Boston, MA
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
The remainder of my message got cut off from my above post...so here's the rest:

( the two variables being $userEmail and $state.)

So that's the form....'emailprocessstate.php' is the code that processes the data and is written in my first post.

Like i said it works great on another site I did, but no dice on the next. I'm totally boggled why...

Any other insight would be great. I've heard things about allowing Global variables on a Win 2K server....maybe this has something to do with that.

I'm new at this and thus a little in the dark. I appreciate and the insight and your patience. Thanks for the reply BTW.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 11-13-03, 06:08 PM
evo4ever evo4ever is offline
Software Developer Guru
 
Join Date: Aug 2003
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
Ahh! this is a common problem! You have Registered Globals turned off. You need to use the $_POST[] array to retrieve form variables.

Your vars would be: $_POST["userEmail"] and $_POST["state"].
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 11-13-03, 10:16 PM
chimchim chimchim is offline
New Member
 
Join Date: Nov 2003
Location: Boston, MA
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
IT WORKED. Thanks!!!!!!

You were correct about the Register Globals. On the site the script was working on they were turned ON. On the site I was having difficultly with, they were consequently turned OFF.

It actually only worked when I named the files $_GET['userEmail'] and $_GET['state']. For some reason it didn't work with the post attributes in the html form and php processing file.

Anyway~ thank you VERY MUCH for the time I really appreciate you shedding some light on this for me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Download files from another server using script! benweston Script Requests 5 01-17-06 10:29 AM
Matrix Reseller - Windows 2003 and FreeBSD vortech General Advertisements 0 11-02-03 11:06 PM
PHP script required Mickey Job Offers & Assistance 8 09-07-03 04:00 PM
30% off Hosting - Free PHP Script Autoinstaller cyberwisdom General Advertisements 0 07-06-03 02:47 PM
Control Panel for Windows 2000 Damian The Lounge 10 06-16-03 02:00 PM


All times are GMT -5. The time now is 10:50 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.