Web Server Configuration
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsWeb DesignWeb Server Configuration

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old February 10th, 2003, 05:56 PM
timburgan timburgan is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 3 timburgan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation MAJOR PROBLEM - PHP on Apache Server

I have just setup PHP & MySQL to run on my computer using Apache but following this step-by-step tutorial (URL).

It seems that PHP is not able to pass variables from one page to another on my local server. When I upload the same pages to my host - they work fine!

Here is the code for the page that creates the variable:

PHP Code:
<html>
<!-- 
userform.htm -->
Please enter your name:
<
form action="processform.php" method="post">
  <
input name="username" type="text"><br>
  <
input type="submit" value="submit">
</
form>
</
html


Here is the code for the page that prints the variable:
PHP Code:
<html>
<!-- 
processform.php -->
  <?
php
    
echo ($username);
  
?>
</html> 


Here is the source for when the page is viewed in my browser:
PHP Code:
<html>
<!-- 
processform.php -->
</
html


Obviously something somewhere needs to be adjusted - can someone please assist me with this. It would be greatly appreciated.

Thankyou

Tim Burgan

Reply With Quote
  #2  
Old February 10th, 2003, 06:02 PM
Lindset Lindset is offline
weirdomoderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Location: Alta, Norway
Posts: 370 Lindset User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to Lindset Send a message via AIM to Lindset
You're having problems because register_globals is off.. My advice is to kepp register_globals off, but instead start using the superglobal arrays for fetching the get, post, cookie and session variables

In your case this is the code you need to use

PHP Code:
<html>
<!-- 
processform.php -->
  <?
php
    
echo ($_POST['username']);
  
?>
</html> 


You can read more about register_globals on this page of the php manual

Good luck
__________________
Best Regards,
Håvard Lindset

Reply With Quote
  #3  
Old February 10th, 2003, 06:54 PM
timburgan timburgan is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 3 timburgan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks..

..I'll keep global variables OFF - because the manual suggests that there are security issues having this switched ON.

Considering I practically know nothing about PHP yet - it's probably the best move.

Cheers

Reply With Quote
  #4  
Old February 11th, 2004, 08:11 AM
jcwilkinson jcwilkinson is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 2 jcwilkinson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question PHP is not able to pass variables from one page to another

I have Apache 2 set up on Windows XP Pro, PHP 4.3.4 (manual install). If I use this code to POST from one page to another:

Page 1 (test_post1.html):

<html>
<!-- userform.htm -->
Please enter your name:
<form action="test_post2.php" method="post">
<input name="username" type="text"><br>
<input type="submit" value="submit">
</form>
</html>

Page 2 (test_post2.php):

<!-- test_post2.php -->
<?php
if (isset($_POST['submit'])){
echo ($_POST['username']);
} else {
echo 'Form not submitted.';
}
?>

All I see is "Form not submitted". If I leave out the test for the submit, I do see the value of the "username" variable. Is this normal behavior? Register globals is off. I see the phpinfo() stuff fine.

Reply With Quote
  #5  
Old February 12th, 2004, 03:49 AM
Spongy's Avatar
Spongy Spongy is offline
Alternately High
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: Hilversum, Netherlands
Posts: 223 Spongy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 56 m 41 sec
Reputation Power: 5
Send a message via MSN to Spongy
Try to switch your statement. Check if $_POST['submit'] does not exists:
PHP Code:
<?php 
// test_post2.php 
if (!$_POST['submit']){ // See that I left isset out!
echo 'Form not submitted.';
} else {
echo (
$_POST['username']); 
}
?>

Minor difference, but maybe it'll work.

Reply With Quote
  #6  
Old February 12th, 2004, 08:06 AM
jcwilkinson jcwilkinson is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 2 jcwilkinson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks, but that did not work. However, I did find that with your code, if I put name="submit" in the input tag of the html form, it worked! I think I'll go with that for now.

I don't believe you should have to do that, though. I also found that if I don't use Apache2, but use IIS instead, the POST code works fine. So I suspect the problem has to do with either the Apache configuration or some setting in Windows that interferes with the POST process. Unfortunately, I'm just starting with all the open-source technologies, so I'll just have to muddle through.

Reply With Quote
  #7  
Old February 12th, 2004, 09:15 AM
hai mame hai mame is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 8 hai mame User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
hi,

my project is working in my local machine properly, but after uploaded in the server (ie. in online) when i clicked a record or updated a record it is affected. but if i click back button and refresh the page it shows the that record which i tried to delete. I think the problem is with the session cache. It takes from the session cache memory. So it doesnt goes tothe server and takes the original available records, so kindly help me sort it out.

U can also mail me in this regard,

sivakumar1978@yahoo.com
mshivakkumar1978@hotmail.com

thankx

shiva

Reply With Quote
  #8  
Old February 12th, 2004, 04:30 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 4 m 48 sec
Reputation Power: 8
jcwilkinson,

Are you pressing enter, or are you clicking the submit button?
Some browsers don't send the submit button when you simply press enter from a text field... sometimes its better to test if the textfield exists instead of the submit button.



hai mame,

Is it inserting the record into the database, or simply displaying it to the page?
It could just be your browser's cache/temp files

Reply With Quote
  #9  
Old February 12th, 2004, 10:59 PM
hai mame hai mame is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 8 hai mame User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
hi,

this is not i asked whenever i delete a record from my site it is affected in the database. But when i click back button and refresh to see the remaining record it also shows my deleted record. It is clear that the problem is with the session cache. every time when click back button it should go to the server and has to pick the record from the server and not from the session cache. For that how should i change my cache setting for the server.


thanx
shiva

Reply With Quote
  #10  
Old February 13th, 2004, 02:07 AM
Spongy's Avatar
Spongy Spongy is offline
Alternately High
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Location: Hilversum, Netherlands
Posts: 223 Spongy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 56 m 41 sec
Reputation Power: 5
Send a message via MSN to Spongy
Try this in the page where the data is displayed:

<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">

Just put it between the <HTML> and </HTML> tags.
Now the page will not be cached at all.

Reply With Quote
  #11  
Old February 13th, 2004, 09:53 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 4 m 48 sec
Reputation Power: 8
when i click back button and refresh to see the remaining record it also shows my deleted record

My question was, is the record still in the database, or simply displayed?

If its simply being displayed on the page than its just your browser's cache...
Spongy's tags would work, or you could send HTTP headers via PHP

PHP Code:
 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    // Date in the past
header("Last-Modified: " gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header("Cache-Control: no-store, no-cache, must-revalidate");  // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0"false);
header("Pragma: no-cache");                          // HTTP/1.0 

Reply With Quote
  #12  
Old February 14th, 2004, 03:57 AM
hai mame hai mame is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 8 hai mame User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How to trace the bounced emails

hi,

I am sending many mails from my server using mail() function in php. But i dont know that all the email addresses stored in the data base are correct. when a mail is sent to a fake email address, how do i trace it in php.

what ever the question i asked here i am getting answer too late.I think this is because of the location iam in.
ok. if anybody help me to solve the above said probs please do mail me

shiva

mshivakkumar1978@hotmail.com

Reply With Quote
  #13  
Old February 14th, 2004, 11:23 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 4 m 48 sec
Reputation Power: 8
perhaps asking these questions in a new thread would yeild better results...
your questions are off-topic in this particular thread

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsWeb DesignWeb Server Configuration > MAJOR PROBLEM - PHP on Apache Server


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump