Re: Does HTACCESS block $_POST ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi again. Thank you Ed.  - its 4 am & I'm going back to bed..  however
this is getting WEIRD..   (midnight snack..)

data testing: - phpinfo();

enable_post_data_reading = On
post_max_size = 50M

1) I've created a test.php script:

<?php
$xa=print_r($_POST,true);
$va="BLUE\n$xa\n";
$xa=print_r($_REQUEST,true);
$va.="REd\n$xa\n";
echo "<pre>$va</pre>\n";
 exit;
?>

2) Ive modified my html form:-  (the top part of the form is a
duplicate of the complete form...) - addresses are just my test
account / fake

// test form
<form action="/vyb/test.php" method="post">
<select class="w3-select" name="viewaddress"  onchange="this.form.submit()">
<option value="">Home/main office</option>
<option value="909-2-2" selected="selected">(909-2-2) 88 Newland St,
Bondi Junction NSW 2022</option>
</select>
<p><button class="w3-btn w3-teal">View Location</button></p>
</form>


<br /><br />

// original form
<form action="/vyb/" method="post">
<select class="w3-select" name="viewaddress"  onchange="this.form.submit()">
<option value="">Home/main office</option>
<option value="909-2-2" selected="selected">(909-2-2) 88 Newland St,
Bondi Junction NSW 2022</option>
</select>
<select class="w3-select w3-yellow" name="CHANGEURL">
<option value="/vyb/">no action specified - select an action</option>
<option value="/vyb/desc" >update business/location description</option>
</select>
<select class="w3-select w3-yellow" name="DISPLAY">
<optgroup label="FUNCTIONS NOT GOING YET">
<optgroup label="Services">
<option value="ACTIONviewservice" >View Services</option>
<option value="ACTIONaddservice" >Add a Service</option>
<option value="ACTIONremoveaservice" >Remove a Service</option>
<optgroup label="Location status">
<option value="ACTIONlocationstatus" >Update your address status (in
development)</option>
<option value="ACTIONlocationphone" >Update your phone number for this
address</option>
<optgroup label="Hours">
<option value="ACTIONmodifyhours" >Modify opening hours</option>
<optgroup label="Jobs">
<option value="ACTIONviewjobs" >View your employment requests</option>
<option value="ACTIONaddjob" >Add a new position/job</option>
</select>
<p><button class="w3-btn w3-teal">View Location</button></p>
</form>


RESULTS:-

If i change the SELECT on my 1st form, i *DO* get results... (test.php)

If i do any change to the address on 2nd form - NO RESULTS - both
scripts in the same URL/directory...

I'm using PHP SMARTY - so html form is in the templates directory, &
php scripts in the php directories

back to bed - I'll do an hour or so more test in morning - then more after work.

(Ps - this form is behind a password system - I need to manually
create a test account for anyone - it's not open/public...)

PPS - the blue and red ECHOS are also in the live php - the top few
lines.. No PHP processing before then, and it's blank results.

Oh yes - htaccess:


Options +FollowSymLinks
RewriteEngine On


RewriteRule ^test.php [L]
RewriteRule ^(.*)$ index.php   [QSA,L]

(END HTACCESS)
- i'll want the POSt and GEt values to be avaialble if set...

EXTRA:  class ??
I just use functions - been programming a few decades, but all
hand-coded...  I rarely use off-the shelf codes...
haven't really got into classes & such..

Goodnight - i'll try again in daylight





On Tue, 22 Apr 2025 at 00:20, Ed Greenberg <edg@xxxxxxxxxxxxx> wrote:
> Hi, I think my code has posted variables through rewrites all the time.
> I've never considered that it wouldn't work.
>
> I went through a troubleshooting process in my mind (a dark and
> dangerous place) and came up with this.
>
> As  a test, you might take out the htaccess and post to the page
> directly (unclean URLs) and see if the POST variables come through.
>
> Is the posted data present in $_REQUEST?
>
> Does your php.ini or other source of settings have
> enable_post_data_reading set on?  I didn't even know that this setting
> existed until I went searching this morning.
>
> Is your php_max_size variable set in such a way to interfere with the
> posted variables?
>
> Perhaps you should try another script with just the first line (the
> print_r) statement and see if you can post to that, with and without a
> rewrite.
>
> Does your page contain a class? If so, is your print_r accidentally
> inside the class? (I got this from a 12 year old stack overflow post)
>
> Let us know how your troubleshooting is going. Hopefully some others
> will chime in.
>




-- 

Gordon.



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux