PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I posted for some help as a php newbie. Great response but night #3 and it's still not working. Been through a re-install of php etc. I can do what I like with variables on one php page such as adding, subtracting variables etc. so php SEEMS to be working on my server. My problem is that I'm trying to post a simple set of variables from a form on a html page to a receiveing action page. When I post the form, there is simple a blank page! My html header and footer source code is viewable when I look at the source code, but the php code has not been processed.
There is no error in my Apache log to indicate anything going wrong. I'm using php 4 and Apache 2 on a W2K PC. Can someone give me a simple piece of code to check whether a form post is working or not.
I'm an experienced html and ColdFusion coder so I'm not new to web coding and am pretty sure my html is ok in my samples. Is there a possible php configuration error that I'm not picking up?
Ran php info command.
Everything worked fine. Html output showing my system settings
==========================================
Here's my form code (stripped to the bare essentials)
==========================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
</body>
</html>
============================================
Here's my action page
============================================
<html>
<head>
<title>hello</title>
</head>
<body>
<?php
echo "$_POST['FirstName']";
?>
</body>
</html>
============================================
When I post this form, I get no error, no error in my Apache
log either. Here is the processed html from 'view source'
============================================
<html>
<head>
<title>hello</title>
</head>
<body>
</body>
</html>
============================================
Here is an error messag I get when I single quote the variable
as ['variable'] on the action page as suggested on the forum
============================================
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE'
or `T_NUM_STRING' in C:\webroot\Sandbox\phpLearning\
formaction.php on line 11
============================================
I feel myself moving back to ColdFusion!!!
Nope! still not working with Red Hair's code. Syntactical nightmare! I've still got the clean html with no sign of php being processed - although, no error messages. This is going to turn out to be something really stupid on my part.
Odd, I just copied and pasted your code onto my server and with redhair's correction it ran fine. It must be a configuration problem.
Something is not right.. If Apache wasn't processing the PHP at all then you would see it in the source. I know this is fundamental but you need to confirm your action is submitting to the correct PHP page. I've been so bone headed before to have a similar problem only to turn out I was working on the wrong page... Is your server accessible from the internet? If so, can you give us the URL to the phpinfo file? Not sure what I expect to find but it couldn't hurt.
Last edited by mrvanjohnson on Thu Jul 10, 2003 6:25 pm, edited 1 time in total.
Thanks Red Hair. That was not supposed to be a bad comment. I really appreciate the help. This forum is brilliant, really like the quick response from people who know their stuff better than me. I've got to go get some sleep (12:30am here), I've got a client meeting in the morning.
Thanks for the help and I'll keep the faith. I know php is cool - just need to get to know it,
When you wake up, could you do two things. First, give us an update of the exact code you are using on your action page (the one giving you the problem), and also, if you could, the Url where we can test this out. From what I see, the suggestions so far should have worked. Also, one final request, a Url to your phpinfo() page, so we could take a look at the configuration. Maybe something is barfed, but I doubt it.