RE: [PHP] $_POST not working with str_replace

From: Date: Tue, 23 Mar 2004 23:08:14 +0000
Subject: RE: [PHP] $_POST not working with str_replace
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-181328@lists.php.net to get a copy of this message
PHP Email List wrote: > Ok here's my problem, I'm in the midst of creating a string replace to work > on a rtf file that is on the server, this fuctionallity works perfect with > "GET" but not "POST", I guess I don't understand why. [snip] > $name = $_POST['FNAME']; [snip] > $output = str_replace("<<FNAME>>",$name,$output); There's no reason why something would work with $_GET['FNAME'] and not with $_POST['FNAME'], so I can understand why you're confused. Are you sure there are even any values in $_POST? Right at the beginning of rtf.php, put a print_r($_POST) to see what the values are. If $_POST is empty even when you put values in the form, then it must be an issue with your web browser or server not allowing POST values (that would be very odd, though). ::John, Ok I tried the print_r($_POST) and received... Array ( [FNAME] => test [LNAME] => t [ADDRESS] => t [CITY] => t [STATE] => t [ZIP] => t [DATE] => t [PARAGRAPH1]=> t [PARAGRAPH2] => t [FROM] => t [SUBMIT] => TEST ME ) So they array isn't empty for my post. Obviously the values don't matter for this array, but the array is still not being brought into the str_replace function. Is it possible that str_replace requires "GET" opposed to "POST" for it to work? This is becoming very odd! Possible bug? I hate throwing that out there but it doesn't make sense why one would work and the other wouldn't since all any of them are doing is holding "strings". Any other ideas? Thanks, Wolf

« previous php.general (#181328) next »