SunQuest
           PHP Installation
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Installation

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old October 8th, 2003, 09:39 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
PHP stops executing after submit

[Windows Xp, PHP 4.2.2]

hi,

I'm a PHP beginner and I'm working through some simple tutorials. I create to files, login.html and stevespage.php. Login.php contains a form which collects data and submits it to stevespage.php for display. Problem is that when I click on the submit button the target page is called and the HTML shows up but anything enclosed in the PHP tag is ignored?? Does anyone have any idea how I can sort this? Here's the code:

login.php:

<html>
<head>
<title>My Form</title>
</head>
<body>

<form action="stevespage.php" method="POST">

<?php print ("PHP IS WORKING!");?>

My name is:
<br> <input type="text" name="YourName">

<p> My favorite dirty word is:
<br> <input type="text" name="FavoriteWord">
<p>

<input type="Submit" name="Submit" value="Enter My Data!">
</form>

</body>
</html>

stevespage.php:

<html>
<head>
<title>Title here!</title>
</head>
<body>
<h1>HTML PRINTS OKAY!</h1>

<?php
print ("PHP IS WORKING!");
?>
</body>
</html>

Any help is GREATLY appreciated!

Thanks
Steve

Reply With Quote
  #2  
Old October 8th, 2003, 10:06 AM
mathewvp mathewvp is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 143 mathewvp User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: PHP stops executing after submit

In the stevespage.php
"PHP IS WORKING!" is not printed???
if you are trying to print the values of "YourName" and "FavoriteWord" you will have to use $_POST["YourName"] and $_POST["FavoriteWord"] instead of $YourName and $FavoriteWord.(Newer php versions has some changes).
By the way,is php properly installed?Whats the web server?
create a new phpfile
<?
phpinfo();
?> and try calling that script

Reply With Quote
  #3  
Old October 8th, 2003, 10:32 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: PHP stops executing after submit

hi,

What happens is that when I press the submit button on the login.php, I get the HTML text ("HTML PRINTS OKAY") appearing on the page but not the text which I print via PHP i.e "PHP IS WORKING" does not print. The odd thing is that I include a PHP script in login.php which prints "PHP IS WORKING" and that works okay! It's only when I make the submission and it tries to execute the PHP script in stevespage.php . Also if I access the stevespage.php by simply loading it into a browser it works okay. The problem only occurs when the page is loaded because of a submission. Any ideas??

Reply With Quote
  #4  
Old October 8th, 2003, 02:16 PM
CodeKadiya CodeKadiya is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Colombo,Sri Lanka
Posts: 2,313 CodeKadiya User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
Send a message via Yahoo to CodeKadiya
RE: PHP stops executing after submit

Humm.... seems odd... check at least this code works..
php Code:
Original - php Code
  1.  
  2. <?
  3. if($_POST['submit']){
  4.     echo "Your name : ".$_POST['myName'];
  5.     echo "<br>Your Age : ".$_POST['myAge'];
  6. }
  7. ?>
  8. <form action="<? echo $_SERVER['PHP_SELF'] ?>" method="POST">
  9. My Name: <input type="text" name="myName">
  10. <br>
  11. My Age: <input type="text" name="myAge">
  12. <br>
  13. <input type="Submit" name="submit" value="Submit Data">
  14. </form>

Reply With Quote
  #5  
Old October 8th, 2003, 02:48 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: PHP stops executing after submit

hi,

Tried running the code you supplied and got the following error:
PHP Notice: Undefined index: submit in D:devFoxServwww~scp.php on line 2

Reply With Quote
  #6  
Old October 8th, 2003, 02:56 PM
CodeKadiya CodeKadiya is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Colombo,Sri Lanka
Posts: 2,313 CodeKadiya User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
Send a message via Yahoo to CodeKadiya
RE: PHP stops executing after submit

Try to replace the php part of code with this one..
php Code:
Original - php Code
  1.  
  2. if($submit)
  3. {
  4.     echo "Your name : ".$myName;
  5.     echo "<br>Your Age : "$myAge;
  6. }
  7.  

Reply With Quote
  #7  
Old October 8th, 2003, 02:57 PM
CodeKadiya CodeKadiya is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Colombo,Sri Lanka
Posts: 2,313 CodeKadiya User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
Send a message via Yahoo to CodeKadiya
RE: PHP stops executing after submit

What was the output for code phpinfo()?

php Code:
Original - php Code
  1.  

Reply With Quote
  #8  
Old October 8th, 2003, 04:29 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: PHP stops executing after submit

hi,

Tried the following:

<?php
if($submit)
{
echo "Your name : ".$myName;
echo "<br>Your Age : ".$myAge;
}
?>

<form action="<? echo $_SERVER['PHP_SELF'] ?>" method="POST">
My Name: <input type="text" name="myName">
<br>
My Age: <input type="text" name="myAge">
<br>
<input type="Submit" name="submit" value="Submit Data">
</form>

....and received the following error:
PHP Notice: Undefined variable: submit in D:devFoxServwww~scp.php on line 2

I ran phpinfo() and gave a long list of variables and stuff do you want me to post the values here?

Reply With Quote
  #9  
Old October 9th, 2003, 01:30 AM
CodeKadiya CodeKadiya is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Colombo,Sri Lanka
Posts: 2,313 CodeKadiya User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
Send a message via Yahoo to CodeKadiya
RE: PHP stops executing after submit

No... no need to post all those values here. I just wanted to make sure whether your PHP installation was successful... It seems to be ok.

I will think of this, Not sure what the error is about yet. :

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Installation > PHP stops executing after submit


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


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway