Wierd Problem With $_post/$_get/$_request

Pages: 1, 2
free web hosting

Read Latest Entries..: (Post #11) by kelvinmaki on Aug 7 2007, 03:56 PM. (Line Breaks Removed)
QUOTE(Quatrux @ Aug 7 2007, 11:08 AM) Yeah, I would like to see the full code too, with html, the post data which is sent and how it is gathered and etc. I think it is just a logical mistake somewhere in the code or just it is one of those things which you can't see even if it is so visible ;] I remember I spend some time on such stupid errors, but after a week I just checked with my ... read more.
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Free Web Hosting > Computers & Tech > Programming > Scripting > PHP

Wierd Problem With $_post/$_get/$_request

SilverFox
I'm having a bad problem and no idea how to fix it...it's setting my back on my PHP work.

I have 7 if statements that do something depending on what $_POST['command'] is, it works for the first 6th and on the last one it adds a 1 (only ads the 1 at the end IF its the one in the if statement).

Example of the failing line:
CODE
if ($_POST['final'] == 'yes' AND $_POST['command'] == 'lol' AND $_POST['action'] == 'cmd')
{

The other ifs are like that, just $_POST['command'] == other things.

Those if statements work. It does this with $_GET and $_REQUEST. It does this no matter what I put in the statement and if i make it blank it puts a 1 anyways.

I even put this before the if statement:
CODE
$whattostrp2 = array("1");
  $_POST['command']= str_replace($whattostrp2, "", "$_POST[command]");

STILL adds a 1. I have it echoing the $_POST['command'], hence how I know this. What I don't understand its WHY it does this ONLY on the 7th if statement and not the others. I tried to make it where $_POST['command'] == 'lol1' and it adds ANOTHER 1.

It also does this with else if and elseif. If I redo the IF statement like this:
CODE
if ($_POST['command'] == 'lol')
{


It still fails.

Any ideas? This is really bugging me and I have found NOTHING on it.

 

 

 


Reply

Habble
What's it adding 1 to?

Reply

kelvinmaki
Can you paste the whole code or rather the rest of the if statements? So you trying to get the $_POST data from a form? And for the 'command', what is it? eg. Radio, text input, drop down box.

If you could put some codes from the form till the form action and then the if else statement. Might get some clues on why this happen.

Reply

ethergeek
Just a troubleshooting hunch...rewrite it this way:

CODE
if ( ($_POST['final'] == 'yes') AND ($_POST['command'] == 'lol') AND ($_POST['action'] == 'cmd') )

Reply

SilverFox
@kelvinmaki: Its a text box, and final/action are hidden. The reason I didn't post the whole code is its around 50 lines long or so and if I was to have ALL the if statements around 200 lines. I know its relatively small but its a lil big for a forum post. Also its not an error in the html form, I know how to make an html form correctly and it ONLY happens on the FINAL if statement (although I never tried adding an extra one to see if its the 7th or the last). I'll post more of the code if I can get around to it, I'm pretty busy right now trying to finish this update and working around the house.
@ether: I'll try that out, what I did was just ditch it above 6 for now.

Reply

TavoxPeru
QUOTE(SilverFox @ Aug 1 2007, 02:39 PM) *
I'm having a bad problem and no idea how to fix it...it's setting my back on my PHP work.

I have 7 if statements that do something depending on what $_POST['command'] is, it works for the first 6th and on the last one it adds a 1 (only ads the 1 at the end IF its the one in the if statement).

Example of the failing line:
CODE
if ($_POST['final'] == 'yes' AND $_POST['command'] == 'lol' AND $_POST['action'] == 'cmd')
{

The other ifs are like that, just $_POST['command'] == other things.

Those if statements work. It does this with $_GET and $_REQUEST. It does this no matter what I put in the statement and if i make it blank it puts a 1 anyways.

I even put this before the if statement:
CODE
$whattostrp2 = array("1");
  $_POST['command']= str_replace($whattostrp2, "", "$_POST[command]");

STILL adds a 1. I have it echoing the $_POST['command'], hence how I know this. What I don't understand its WHY it does this ONLY on the 7th if statement and not the others. I tried to make it where $_POST['command'] == 'lol1' and it adds ANOTHER 1.

It also does this with else if and elseif. If I redo the IF statement like this:
CODE
if ($_POST['command'] == 'lol')
{


It still fails.

Any ideas? This is really bugging me and I have found NOTHING on it.

Do you try to do the same thing but instead of using the operator '==' use the operator '===' that also compares if both sides are of the same type.

Best regards,

 

 

 


Reply

vizskywalker
Also, you said you tried
QUOTE(SilverFox)
CODE
$whattostrp2 = array("1");
  $_POST['command']= str_replace($whattostrp2, "", "$_POST[command]");
If I remember correctly, you cannot, at least in PHP 5, which we now use, and I'm pretty sure in PHP 4 as well, assign to $_POST, $_GET, $_REQUEST, and the like. So you would have to assigne $_POST['command'] to something else, then try to strip them. Also, how do you know it is adding a one? What debugging code for that check do you have?

~Viz

Reply

kelvinmaki
QUOTE(SilverFox @ Aug 3 2007, 06:37 PM) *
@kelvinmaki: Its a text box, and final/action are hidden. The reason I didn't post the whole code is its around 50 lines long or so and if I was to have ALL the if statements around 200 lines. I know its relatively small but its a lil big for a forum post. Also its not an error in the html form, I know how to make an html form correctly and it ONLY happens on the FINAL if statement (although I never tried adding an extra one to see if its the 7th or the last). I'll post more of the code if I can get around to it, I'm pretty busy right now trying to finish this update and working around the house.


SilverFox,

Let me get it correctly, you are passing a textbox over by the $_POST, and only at the last IF statement, you are getting the value 1.
So at the last IF statement, what you printed out is value 1 am I right.
It could be an empty array in the $_POST. When its an empty array, using echo, print or print_r, it will gives you a 1.
If that's no the problem, you can pm me with the html codes and the script of IF ELSE. I can test it in my system. That will be easy to debug rather than speculating all the possible reason.

CHEERS

Reply

SilverFox
@tav: That is a good idea, I had to do that before. I'll try that out.
@vizy: Yes but it still shouldn't do that (add the 1 without the stripping).
@Kelvin: Its not empty. I'll get back on this. Really busy.

Reply

TavoxPeru
QUOTE(SilverFox @ Aug 6 2007, 09:19 PM) *
@tav: That is a good idea, I had to do that before. I'll try that out.
@vizy: Yes but it still shouldn't do that (add the 1 without the stripping).
@Kelvin: Its not empty. I'll get back on this. Really busy.

Ok, but i think that if you post your complete code it would be better to us to help you.

Best regards,

Reply

Latest Entries

kelvinmaki
QUOTE(Quatrux @ Aug 7 2007, 11:08 AM) *
Yeah, I would like to see the full code too, with html, the post data which is sent and how it is gathered and etc. I think it is just a logical mistake somewhere in the code or just it is one of those things which you can't see even if it is so visible ;] I remember I spend some time on such stupid errors, but after a week I just checked with my clear head and found it very fast, in fact, it happened much more times than one wink.gif


Agreeded. I've not been coding for long but sometimes do make such mistake that are so visible. And when I show my codes to someone else, they just find out the root cause within a few minutes. So if you want to share your codes, just paste it. Definitely someone will be able to spot something. wink.gif

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Pages: 1, 2
Recent Queries:-
  1. "where = $_post[]" - 261.71 hr back. (1)
Similar Topics

Keywords : wierd, problem, post, get, request

  1. Graphics Driver Out...
    Devie Usage problem... (1)
  2. Freewebhosting: Ml01172.astahost.com
    Request for hosting (0)
    To generate an application for free web hosting please click here: Free Web Hosting
    Request Form I would like to request free web hosting from Astahost. Please find my
    application below. Your Registered Domain Name or Desired Astahost Subdomain Name:
    ml01172.astahost.com Account Username: ml01172 Introduction: My name is
    Darko Maksimovic and I'm a programmer for years now. I need a free hosting service in order not
    to pay for a hosting I don't really NEED, but only WANT. Since I'm already active at forums
    like....
  3. Pc Problem
    (8)
    i have a problem with my PC... when i start a game (FABLE:TLC or shaiya) something starts working
    very fast and louder in my case and the PC shuts down immediately(sometimes) and sometimes i can
    just play the game normally.... when i place my hand over graphics card (Geforce 9600 galaxy) it is
    not very hot..its normal...do u understand?....
  4. Need Help?
    More of a request (9)
    Hi, didn't know where to post this or if I may post this at all. But I'm looking for someone
    to make ranks for a clan. I was wondering if you do this for free or do you charge for your work?
    Graphic Category: Ranks Image/s: It should look something like this Size: 120px X 25px Colours: It
    has to match the forums: http://onlinegameing.freeforums.org/ Text: No text Additional
    Information: anyways, I would appreciate a set of army ranks, I have a sample for you so that you
    know what I want. I need: Private Private First Class Corporal Sergeant Staff Serge....
  5. Problem With Div's In Ie6 And Lower
    (4)
    I'm working on a template for joomla, but I'm heaving some serious problems to get it
    working in IE6 and lower. Basically, this is my layout: CODE
    -------------------------------------------------------------------------------------
    |                                                                                        |          
                 | |                            header                                                
    |                       | | -----------------------------------------------------------------
    |                       | |           ....
  6. Request Form Site Suspended
    (4)
    the request form site is Suspended>.<....
  7. Hdd Stuck On Post
    (9)
    I installed a 30 day trial version of Windows Vista. My drives were as follows:- 40 GB Primary
    Active Partition 37 GB Logical Drive with a single partition With Vista I split the Primary
    partition into two (Delete and re-create) 20 GB partitions. Both of them now became Primary
    partitions. Vista was installed on Drive 1 (20 GB). After the installation, I installed Win XP on
    the other Primary partition. I thought this would allow me to dual boot Win XP and Vista. But, Win
    XP setup overwrote the Vista Bootloader. I changed the active partition to the one where Vista was....
  8. Free Online Speed Test
    Post your results here (14)
    Online bandwidth speed test , helps you to know whether you are getting the bandwidth speed that
    you deserve . Run our free Internet Speed test tool and see just how your internet connection
    measures up. Click here to test Then post your results in the following format : Your Service
    provider : Location : Plan Details : Up speed : Down speed : Promised : Received : Satisfied
    :....
  9. Problem With Move_uploaded_file()
    Permission denied? (5)
    CODE Warning: move_uploaded_file(images/profile/Mordent.jpg)
    [function.move-uploaded-file]: failed to open stream: Permission denied in
    /home/mordent/public_html/withvalour/edit_image.php on line 42 Warning:
    move_uploaded_file() [function.move-uploaded-file]: Unable to move
    '/tmp/phpOWVz7o' to 'images/profile/Mordent.jpg' in
    /home/mordent/public_html/withvalour/edit_image.php on line 42 Any ideas? The code seems fine,
    as it works a treat when I run it locally (on WAMPServer), but as soon as I tr....
  10. Administrator Account Problem In Microsoft Xp [solved]
    I have lost "my documents" (20)
    I have problem with administrator account ... I created new administrator account with this way:
    start /control panel /account users/new account and than I created a new one ; after this I turned
    off computer . I wanted to have two skypes turned on and my friend suggested me to do so... when I
    turned it on the second day , I coudn't enter with the first administrator ,and I entered with
    the administrator that I had created . I have lost my document folder.. please help me . how can I
    enter or can I enter with that first administrator account?? Can my documents be ....
  11. A Gaiaonline Problem
    A problem i want to stop (9)
    I have a problem getting on Gaiaonline. When I go it always says "SLOW DOWN Slow down,
    hotshot! You've been loading pages too fast, and our system doesn't like it. Take a
    break for a few minutes so we can catch up! This is not a ban. Come back in a littlw while,
    ok?" and I want it to stop! So can anyone please help me out here?....
  12. Trojan / Virus Problem ,please Help
    might be (hoon) (18)
    I have been infected with atrojan but i can detect it. and i have detected Hoon trojan and deleted
    it ,but the symptoms of the trojan is still on my pcs network " all driver have an autoplay (right
    click by mouse) and it gives my this message by d-click on any driver ************** SYS.EXE
    QUOTE windows cannot find 'sys.exe',make sure you typed the name correctly and then try
    again.to search for a file ,clicl the start botton then clicl search the virus was detected and
    deleted from all drivers: C:\sys.exe D:\sys.exe E:\sys.exe F:\sys....
  13. Fedora Core 6 Install Problem
    (6)
    I have tried three times to get Fedora Core 6 to install but I keep getting the same error message:
    “there was an error running your transaction, for the following reason(s): file conflicts”. I am
    using all of the default settings except changing the time zone and basically installing all
    packages. The error always happens near the end of the fifth disk. I have run sha hash checking on
    all media and everything checks out. Has anyone had this problem or a possible solution?....
  14. Internet Explorer 7 Problem
    Works fine in Firefox! (Shocker) (8)
    Hey, I'm helping my mom with one of her web projects for class and I've noticed a pretty
    big problem (no thanks to IE7) that cost her a few points. It won't load an image of an email
    icon, however, Firefox will load and display it properly. Here's the line for the image: CODE
    <img src="nationalparks/images/email.gif" width="99" height="100"
    border="0" alt="Email" /> Also, IE7 complains about some ActiveX content,
    but this is just a basic page and NO JavaScript, NO Java applets, NO ActiveX of any ki....
  15. Win Rar Password Problem
    (7)
    i have some trouble with some winrar files password the files is for an ISO and iam trying to remove
    the password because some files has a different password i have tried to change the password but no
    luck ...i used set default password and no luck too if any1 have any idea please post it thanks in
    advance -joe....
  16. Problem With Drag And Drop (or So It Seems).
    (11)
    I'm running on Windows XP with Service Pack 1. The last few days, all of a sudden, the drag and
    drop functionality of explorer (or anything on the operating system that uses system calls in order
    to perform it) screws up completely. I attempt to drag it, and it just flickers a bit to the
    direciton I'm moving it and then fails. It doesn't seem to be the mouse as I can still drag
    a rectangle selection to select multiple files etc, just no drag and drop. However, it isn't
    always like that, it works generally (as far as I know) and stop working out of now....
  17. Frustrating Problem With XP On Laptop
    (19)
    I have my Dualcore AMD Acer laptop, 5102Wlmi, with a 120GB hd, 2 GB ram, etc. I had a friend buy it
    in the states and bring it over just 2 months ago. All of a sudden, the other day when i went to
    turn it on, it would bring up the xp boot screen, and then just hang there. I tried a different hard
    drive. no luck. I tired installing XP, but after booting from cd and loading all the drivers, right
    after the FAT and NTFS drivers, it says "Setup is loading Windows" and then it hangs there. I've
    left it overnight and in the morning it's still in the same place. I can&#....
  18. Spam Problem On My Forums
    (26)
    I’m starting to have a real problem in my forums. Apparently “midget anal porn” is the hottest new
    thing. I didn’t think midgets were into that kind of thing but apparently I’m wrong (apologies to
    any midgets out there). I knew that spam may be a problem on my board but I didn’t think that I
    would be a target just yet. I only have 16 registered users (including the spam bots). How in the
    world did they find me? Just like junk mail I figure this problem is only going to get worst since
    I am now apparently on the list. Does anyone have a solution to this problem? I....
  19. Blue Screen - irql_not_less_or_equal
    computer OS Windows problem booting (35)
    Hi , My computer AMD64 256mb RAM / 80GB HDD / Windows XP Professional recently started showing a
    blue screen while starting .. QUOTE A problem has been detected and windows has been shut down
    to prevent further damage to your computer . IRQL_NOT_LESS_OR_EQUAL (blah blah blah ... )
    Technical Information: *** STOP: 0x0000000A (oxFB07D354, ox000000FF, ox00000001, ox804E2E41)
    Initially, if I restarted it would not come the next time. It used to come only randomly. But
    later it started coming more often, and now it did not start for quite a few times con....
  20. Problem With The ReadOnly Property
    (3)
    I have a problem setting the readonly property of a textbox which depends on a yes and no radio
    buttons selection, I'm sure that my code is correct but i dont know why nothing happens. This is
    code: CODE <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML> <HEAD> <TITLE> New Document </TITLE> <script
    LANGUAGE="JavaScript"> <!-- Begin function changeRadio(sVal) {     if
    (sVal=='n')     {         a.textval.readonly=true;         a.texval.value="&#....
  21. Need To Hack An Admin Account On Xp... No Problem!
    It's so easy to hack an account you'll be amazed (61)
    Well recently one of my good girl that is a friend got a laptop from her dad. Her dad does websites
    so the laptop was new and worked fine, but needed to be defraged. The one problem, her nor her dad
    knew the admin password. I told her to post her question on Trap 17 and it got answered with in
    minutes. All you have to do is these few steps: 1. Reboot 2. Before the windows logo comes up press
    F11 (Just start clicking it over and over again until the windows logo comes up.) 3. Just sit and
    let it do it's thing and when the login screen comes up click on the Admin icon....
  22. Photoshop Cropping Problem
    (7)
    All right. For most of my Photoshop work, I use Photoshop 6.0. Yes, I know it's old, but it
    gets the job done, not to mention I just don't have the money of Photoshop CS or Photoshop CS2
    right now. But I'm getting off topic. Anyways, a few months ago, when I went to crop a
    picture, it wouldn't crop all the way. It would crop to a certain point and then just stop and
    refused to go any further with the cropping box. It seems to only form squares and sometimes
    horizontal rectangles, but only to a certain extent. However, when I opened Adobe Photosho....
  23. XP Problem: Clicking On Folder Opens Search
    (4)
    I have no idea why, but for some reason whenever I click on a folder now it opens it as a search
    instead of just showing me the contents. Whenever I right click it, search is at the top of the tab
    in bold instead of open. Is there any way I can fix this? I have no idea what I did wrong. Sorry,
    I fixxed it.....
  24. Einstein Quiz
    Can you solve this problem? (29)
    Hi everybody; I want to ask the quiz written by Einstein last century.It is called Einstein's
    Riddle.Einstein said that 98% of the people in the world cannot solve his riddle. Are you among the
    other 2%?(Hint:It is really easy:) Hints: 1: There are 5 houses in 5 different colors 2: In each
    house lives a person with a different nationality. 3: These 5 owners drink a certain beverage, smoke
    a certain brand of cigar and keep a certain pet. 4: No owners have the same pet, smoke the same
    brand of cigar or drink the same drink. Further Details: a: The Brit lives in a re....
  25. I Cannot Embed A Google Video In A Joomla Post
    (5)
    I have been struggling all day to be able to embed a google video into one of my joomla posts. I
    tried opening the HTML Source editor...the Flash Editor.... and a box will come up, but there
    isn't anything in it. Can any help me out in explaining how I can get a google video embeded
    into a Joomla Post? Here is an example video for the type of code I need to put on my post for the
    video to show.... I just can't get it to show up....When you view the post, you see the CODE for
    the embed video...but not the video. Help Help Help! here is an example of the....
  26. Counter-Strike Source Clans - Post Your Server IPs
    (15)
    Here is our server ip. 68.8.52.34:27015 Cal This season playoffs 2-0 first match today!
    Come join us....
  27. Problem: I Need Urgent Help. Can't Boot.
    (9)
    Hi all. Thanks for reading this, and helping me... /unsure.gif' border='0'
    style='vertical-align:middle' alt='unsure.gif' /> I have a big problem - I must fix one computer
    for one of my important clients, but, everything seems to be fine, until you turn it on (really
    /rolleyes.gif' border='0' style='vertical-align:middle' alt='rolleyes.gif' /> ) ehm, anyway, when
    computer is turned ON, it boots and when it comes to login screen just blocks, and freezes, and
    there's nothing to do there. Sometimes I can manage to click on user to login, but then freezes
    again. .....
  28. Mozilla Firefox And Runescape
    Problem I had with FFox and RScape. (10)
    When I tried to play Runescape in Mozilla's Free browser (Firefox), I couldn't. However,
    when I tried to play the game in Microsoft Internet Explorer, I could. It may be possible to play
    Runescape in Firefox by altering Firefox's settings, or it could just have been me or chance or
    something that caused me to have a problem.....
  29. Error 406 - Problem In My Phpbb Forum
    Actually a problem with Apache (8)
    When I post the message in my forum contant the word "system" it can't work and said the HTTP
    error 406. I add three Mod : attach mod 2.3.11 , cash mod 2.2.2 , pay money mod 1.0.7 phpBB
    verison 2.0.12 my forum http://siuwing.astahost.com/testmod and then I also setup a model forum
    by cPanel , the error of posting also occur -> http://www.siuwing.astahost.com/testmod2/ the
    model forum havent adding any mod what is the problem ...? /sad.gif' border='0'
    style='vertical-align:middle' alt='sad.gif' /> ....
  30. Help! Problem With My Flash-Drive
    Sh17 happens .. (1)
    Story :: A was installing WinXP on PC B's Flash Drive (FD) was in the USB Slot. While the
    WindowsXP Setup is partitioning, 'A' realised that the light on the FD was blinking ..
    indicating activity so he plucked it out immediately. Now 'B's FD is corrupted .. I
    recovered almost all the data from the corrupted FD using Ontrack's EasyRecovery 6.0 .. It is
    the most amazing software ever developed .. it could virtually recover all data in a drive that had
    been formatted .. Alright .. now is the headache .. there is no way that I could get the drive ....

    1. Looking for wierd, problem, post, get, request

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for wierd, problem, post, get, request
advertisement




Wierd Problem With $_post/$_get/$_request



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE