Jump to content

Framed Web Form testing arrays


chuy08

Recommended Posts

I have constructed a framed web form.  The frames are equally divided into two rows taking up 50% of the screen space each.  The top frame is supposed to be static and the bottom frame is where results should be returned when web form is submitted. 

Currently when I land on this framed web form within a browser I am getting a blank screen.  What I would like to have is a message below that prompts the user to fill in above to get results.  My problem is the test that I am using to evaluate if the POST array has been initialized or not.  I have constructed an if/else statement that is supposed to test for this, example below:

if (is_array($pricing))
    {
        $pricing = $_POST['pricing'];
        print_r($_POST);  //just for testing purposes only
    } else {
        echo "Please fill out form above to get results below<BR>";
      }

When I land on the page for the first time the Please fill out form above... condition is met and printed.  Once I begin to fill in my webform and select the submit button I can't seem to get my test to ever evaluate to true.  Adding my $pricing = $_POST and print_r command to the false section of the if/else statement does what it's supposed to do, but why is the test not responding accordingly.  Any help appreciated.
   
Link to comment
https://forums.phpfreaks.com/topic/26521-framed-web-form-testing-arrays/
Share on other sites

Ok--without seeing the code, I can only offer generalities.  But it would be REALLY helpful if I could see the HTML code and some more PHP code.

1) check the CASE of your variables and form fields.  They HAVE to be the same.  If the Form field is [b]<input type="Pricing">[/b] then you have to obtain the variable like this:  [b]$pricing = $_POST['Pricing'];[/b]
try[code]print_r($_POST);  //just for testing purposes only
if (isset($_POST['pricing']) // < == change this line
    {
        $pricing = $_POST['pricing'];
       
    } else {
        echo "Please fill out form above to get results below<BR>";
      }[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.