473,378 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

problem with $_SERVER['REQUEST_METHOD'] == 'POST'

whatever code I put inside this IF statement:

if ($_SERVER['REQUEST_METHOD'] == 'POST')

I get a parse error. Even 'print "something goes here"' doesn't work.
Any ideas?

Mar 28 '07 #1
6 17497
ry****@gmail.com wrote:
whatever code I put inside this IF statement:

if ($_SERVER['REQUEST_METHOD'] == 'POST')

I get a parse error. Even 'print "something goes here"' doesn't work.
Any ideas?
If you get a parse error you probably have a syntactic error earlier in
the code you have this line in. What do you mean exatly by: "whatever I
put inside this IF statement?" Something like this?

if ($var=='somestring') {
do_something_or_other(); // <== you mean this bit?
}

Please post a larger chunk of the code the statement is part of, then
maybe there's something we can help you with. Like it is the statement
should be ok, assuming it is followed by at least a (empty or
meaningful) statement.
In other words: if (true); is correct, without the ; it's an error.
Mar 28 '07 #2
the problem is fixed. The weird part is, I had to manually re-key a
few of the lines of code. Every time I re-keyed a line, char for char,
the error shifted down one line. Finally I had re-keyed enough of the
lines of code and it worked - to a point.

Now the problem is this:

the script runs fine. It's to upload an image and then resize it.

I have this line of code:

print "<form action=\"<?php print (\$_SERVER['PHP_SELF']); ?>\" method=
\"post\" enctype=\"multipart/form-data\">\n";

when I browse locally to a photo, select it for upload, then submit
it, I get a 404 error with the following path (I chopped off the
unimportant first half of the URL):

/siteAdministration/%3C?php%20print%20($_SERVER['PHP_SELF']);%20?%3E

so it looks to me like it's not parsing the action command
correctly??? I have spent hours on this trying to find the problem and
I cannot see any syntax errors here. Any suggestions out there?

Mar 29 '07 #3
ry****@gmail.com wrote:
the problem is fixed. The weird part is, I had to manually re-key a
few of the lines of code. Every time I re-keyed a line, char for char,
the error shifted down one line. Finally I had re-keyed enough of the
lines of code and it worked - to a point.

Now the problem is this:

the script runs fine. It's to upload an image and then resize it.

I have this line of code:

print "<form action=\"<?php print (\$_SERVER['PHP_SELF']); ?>\" method=
\"post\" enctype=\"multipart/form-data\">\n";

when I browse locally to a photo, select it for upload, then submit
it, I get a 404 error with the following path (I chopped off the
unimportant first half of the URL):

/siteAdministration/%3C?php%20print%20($_SERVER['PHP_SELF']);%20?%3E

so it looks to me like it's not parsing the action command
correctly??? I have spent hours on this trying to find the problem and
I cannot see any syntax errors here. Any suggestions out there?
Your code is wrong. You start with some php code and then introduce new
php opening tags again. That would only make sense when it's part of an
otherwise pure html line.

You probably nee something like this instead:

print "<form action='$_SERVER['PHP_SELF']' method='POST
enctype='multipart/form-data'>";
Mar 29 '07 #4
Schraalhans Keukenmeester wrote:
ry****@gmail.com wrote:
>the problem is fixed. The weird part is, I had to manually re-key a
few of the lines of code. Every time I re-keyed a line, char for char,
the error shifted down one line. Finally I had re-keyed enough of the
lines of code and it worked - to a point.

Now the problem is this:

the script runs fine. It's to upload an image and then resize it.

I have this line of code:

print "<form action=\"<?php print (\$_SERVER['PHP_SELF']); ?>\" method=
\"post\" enctype=\"multipart/form-data\">\n";

when I browse locally to a photo, select it for upload, then submit
it, I get a 404 error with the following path (I chopped off the
unimportant first half of the URL):

/siteAdministration/%3C?php%20print%20($_SERVER['PHP_SELF']);%20?%3E

so it looks to me like it's not parsing the action command
correctly??? I have spent hours on this trying to find the problem and
I cannot see any syntax errors here. Any suggestions out there?
Your code is wrong. You start with some php code and then introduce new
php opening tags again. That would only make sense when it's part of an
otherwise pure html line.

You probably nee something like this instead:

print "<form action='$_SERVER['PHP_SELF']' method='POST
enctype='multipart/form-data'>";

add another single quote after POST. My bad.
Mar 29 '07 #5
ry****@gmail.com kirjoitti:
the problem is fixed. The weird part is, I had to manually re-key a
few of the lines of code. Every time I re-keyed a line, char for char,
the error shifted down one line. Finally I had re-keyed enough of the
lines of code and it worked - to a point.

Now the problem is this:

the script runs fine. It's to upload an image and then resize it.

I have this line of code:

print "<form action=\"<?php print (\$_SERVER['PHP_SELF']); ?>\" method=
\"post\" enctype=\"multipart/form-data\">\n";
Change this to
print "<form action='" . $_SERVER['PHP_SELF'] . "' method='post'
enctype='multipart/form-data'>\n";
>
when I browse locally to a photo, select it for upload, then submit
it, I get a 404 error with the following path (I chopped off the
unimportant first half of the URL):

/siteAdministration/%3C?php%20print%20($_SERVER['PHP_SELF']);%20?%3E

so it looks to me like it's not parsing the action command
correctly??? I have spent hours on this trying to find the problem and
I cannot see any syntax errors here. Any suggestions out there?

--
Ra*********@gmail.com
"Olemme apinoiden planeetalla."
Mar 29 '07 #6
Schraalhans Keukenmeester wrote:
Schraalhans Keukenmeester wrote:
>ry****@gmail.com wrote:
>>the problem is fixed. The weird part is, I had to manually re-key a
few of the lines of code. Every time I re-keyed a line, char for char,
the error shifted down one line. Finally I had re-keyed enough of the
lines of code and it worked - to a point.

Now the problem is this:

the script runs fine. It's to upload an image and then resize it.

I have this line of code:

print "<form action=\"<?php print (\$_SERVER['PHP_SELF']); ?>\" method=
\"post\" enctype=\"multipart/form-data\">\n";

when I browse locally to a photo, select it for upload, then submit
it, I get a 404 error with the following path (I chopped off the
unimportant first half of the URL):

/siteAdministration/%3C?php%20print%20($_SERVER['PHP_SELF']);%20?%3E

so it looks to me like it's not parsing the action command
correctly??? I have spent hours on this trying to find the problem and
I cannot see any syntax errors here. Any suggestions out there?
Your code is wrong. You start with some php code and then introduce new
php opening tags again. That would only make sense when it's part of an
otherwise pure html line.

You probably nee something like this instead:

print "<form action='$_SERVER['PHP_SELF']' method='POST
enctype='multipart/form-data'>";

add another single quote after POST. My bad.
Geez, and brackets {} around $_SERVER['PHP_SELF']. Not my day apparantly...
Mar 29 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: GazK | last post by:
I have an image viewing page which resizes an image to a sensible sizebefore displaying. The user should then be able to choose "25% larger" or smaller and the resized image display. The problem I...
2
by: ozeh | last post by:
Hi, when I used metod post in a form, then i read posted variable and try to print, I have : In FORM text(variable_nr1) = 'test_var' In php <?php echo $_POST; ?> on screen :
0
by: Rogue 9 | last post by:
I'm so sorry I'm using Pan v0.13.0 and it was doing screwy things when I tried to postfrom my sendlater folder.I re wrote the post but it went awry again and now I find multiple copies of my posts...
6
by: Pete Mahoney | last post by:
I am trying to 'POST' values from a form in a ASP file that has anonymous access permissions. I can retrieve the form values when I redirect to this page from another page which has also has...
5
by: Jack | last post by:
Hi I am trying to test a form as to its correct action. I am facing two problems. 1) When I click the submit button, the registrationconfirmation.asp is not activated. The...
6
by: Stephen Cook | last post by:
Having worked through the problems around enabling the document function using an XmlUrlResolver I started work on building a useful class to hide the intricacies. Trying to generalise the process...
1
by: Norma | last post by:
I am only posting this again because I did not get any responses the first time I posted it. Excuse me for being redundant here but I can't figure this one out. Original Post: I am trying to...
9
by: Nicko | last post by:
Hey everyone, I'm on a server running PHP 5.0.5 but we've discovered that there's a problem with it. We cannot create a form with method "POST" because it simply will not post the form data...
1
by: Tony | last post by:
I would really appreciate it if anyone has any thoughts on this one - it's driving us mad. We have a web site which is using ASP.NET 1.1 and which is load balanced across two web servers with IP...
2
by: shadowman | last post by:
So here's the situation: I need to write a PHP script which accepts form submissions using all methods (GET and POST) and all content types (application/x-www-form-url-encoded and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.