Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7876745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:12:57+00:00 2026-06-03T03:12:57+00:00

Im trying to get form post values and if they match certain criteria redirect

  • 0

Im trying to get form post values and if they match certain criteria redirect only my page doesnt seem to…

I have a form with multiple input fields

HTML

<form method="post" action="?page_id=151">

  <div style="display: block;" id="Q1">
                    <label for="vehicleType">1. What type of vehicles do you have?</label>
                    <select id="vehicleType" name="vehicleType">
                        <option selected="selected" value="choose">Please choose</option>
                        <option value="hgv">HGV</option>
                        <option value="psv">PSV</option>
                        <option value="lgv">LGV</option>
                        <option value="car">Car</option>                            
                        <option value="mixed">Mixed Fleet</option>
                    </select>
                </div>

                <div id="Q2group1">
                    <label for="coverageRegion">2. Do you require national or international coverage?</label>
                    <select id="coverageRegion" name="coverageRegion">
                        <option selected="selected" value="choose">Please choose</option>
                        <option value="national">National</option>  
                        <option value="international">International</option>
                    </select>
                </div>

                <div id="Q2others">
                    <label for="pricing">2. Do you prefer a fixed weekly price or a pump-related price?</label>
                    <select id="pricing" name="pricing">
                        <option selected="selected" value="choose">Please choose</option>
                        <option value="fixed">Weekly fixed price</option>  
                        <option value="pump">Pump-related price</option>
                    </select>
                </div>

                <div id="Q3group1">
                    <label for="locationType">3. What type of site do you prefer?</label>
                    <select id="locationType" name="locationType">
                        <option selected="selected" value="choose">Please choose</option>
                        <option value="truckstops">Truck stops at lowest price</option>  
                        <option value="motorway">Branded motorway sites</option>
                    </select>
                </div>


             <div id="Q3others">
                    <label for="siteCoverage">3. What site coverage do you need?</label>
                    <select id="siteCoverage" name="siteCoverage">
                        <option value="choose">Please choose</option>
                        <option value="countysites">County</option>
                        <option value="nationalsites">National</option>
                    </select>
                </div>


                <div id="Q4others">
                    <label for="county">4. Select your county:</label>
                    <select id="county" name="county">
                        <option value="choose">Please choose</option>
                        <optgroup label="England">
                            <option>Bedfordshire</option>
                            <option>Berkshire</option>
                            <option>Bristol</option>
                            <option>Tyrone</option>
                        </optgroup>
                    </select></div>

                <div id="searchbuttondiv"> <input type="submit" id="searchbutton" onclick="_gaq.push(['_trackEvent', 'Fuel Card Search', 'Homepage Select Criteria'])">    </div>   

            </form>

PHP

if ($_POST['vehicleType'] == 'car' && $_POST['pricing'] == 'fixed' && $_POST['coverageRegion'] == 'national') {
        echo '<script>alert("hi");</script>';
        // header('Location: /car-weekly-national/');
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T03:12:58+00:00Added an answer on June 3, 2026 at 3:12 am

    One of your conditions is falling (and because they are all bound by AND, all of the if statement fails.

    Have an else statement where you var_dump all relevant variables and see what’s wrong.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get some form data from POST method. Here's the code
I am trying to get post a form to a hidden, dynamically inserted iframe,
I have a contentPane with a remote form, I'm trying to get the form
I have a custom registration form. I am trying to redirect users to a
I am trying to submit a simple POST form to a website to get
I'm trying to create a form with hyperlinks. When clicked, they submit the page
Magento 1.6.1 I am trying to get form data on my observer. I tried
Im trying to get a form working in Internet Explorer. I see that when
I'm trying to get my C# form to be parented correctly in a third
I am trying to get the following form submission to show alert box if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.