This script seemed to work before and not it is not - I narrowed the issue down to my variables not even passing - here is the code - can anyone help me by seeing by they may not be passing? <form action="profile.php" method="POST"><input type="hidden" name="profile" value="user"/><input type="image" src="image.jpg" width=114 height=79></form> Code (markup): ... and then in the profile.php script: $proname=$_REQUEST["profile"]; echo "proname: ".$proname; Code (markup): ... and I get nothing, and I also tried: $proname=$_POST["profile"]; echo "proname: ".$proname; Code (markup): ... and both echos: proname: Code (markup): Can anyone see what could be wrong? All my other pages that use POST variables are working fine - just this particular one ... help appreciated - thanks!
I am echoing $proname on profile.php which is the file referenced in the action on the form ... I'm stripping all the other code off the page to see if I can narrow down the conflict ... makes no sense to me ...
Are you sure you haven't overwritten the $proname variable? Also try adding error_reporting(E_ALL); at the top of profile.php... see if that brings any errors.
At the very top of your code, put: echo "<pre>"; var_dump($_POST); echo "</pre>"; PHP: That will tell you what's really coming in to $_POST.
I am now posting to profile2.php which is just an echo statement along with the following: <HTML> <HEAD> <?php error_reporting(E_ALL); echo "<pre>"; var_dump($_POST); echo "</pre>"; if ($_REQUEST) { foreach (array_keys($_REQUEST) as $key) { $$key = $_REQUEST[$key]; echo $key.': '.$$key.'<br />'; } } ?> </BODY> </HTML> PHP: ... and this is the output ... array(0) { } __utma: 149885684.114437545.1259699287.1264189676.1264217867.19 __utmz: 149885684.1264189676.18.6.utmcsr=webmessenger.yahoo.com|utmccn=(referral)|utmcmd=referral|utmcct=/ PHPSESSID: 0547e08ee48fb66012dc149002a8ac3c PHP: I guess now I am going to strip the file with the form on it to have that be the only thing on the page and see what happens there ... UPDATE: Well, a stripped down form submits the variables as expected to the page ... so apparently I have a conflict somewhere in my code that I have to track down ...
Ok - I figured out that when I post to a URL with the whole URL with an absolute path, it does not pass the variables, but when I pass it with just the file name referenced, ie. <form action="profile.php" method="POST"> instead of <form action="http://www.domain.com/profile.php" method="POST">, then it works ... I need to code the URLs in because I am using mod re-write on here and it will result in file not found errors if I do not code the URL that way, but why is the post not working? That still does not make sense to me - and it works on my other pages?