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 7974783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:28:33+00:00 2026-06-04T08:28:33+00:00

I was trying to get variable in Query String from URL. But somehow, its

  • 0

I was trying to get variable in Query String from URL. But somehow, its just got one variable instead of getting all variables from querystring. I really don’t know what goes wrong with my code. Here is the code I want to print out error from the invalidate form:

<?php       
            displayForm();
            function displayForm(){
                ?>                    
                <form action="./prod_add_action.php" method="post" name="addproductForm">
                    <fieldset>
                        <legend>Online Ordering System Setup</legend>                        
                        <label for="product_name">Product Name: </label><input type="text" name="product_name" value="" /><?php echo $_GET["name_error"]; ?>
                        <label for="product_date">Product Date: </label><input type="text" name="product_date" value="" /><?php echo $_GET["date_error"]; ?>
                        <label for="product_price">Product Price: </label><input type="text" name="product_price" value="" /><?php echo $_GET["price_error"]; ?>
                        <input name="add_button" type="submit" value="Add" />
                        <input name="reset_button" type="reset" value="Clear" />
                    </fieldset>
                </form>
                <?php
            }
            ?>

And here is the code I created the querystring:

$query_string = "name_error=" .urlencode($name_error) ."&amp;date_error=" .urlencode($date_error) ."&amp;price_error=" .urlencode($price_error);
            header("Location: ./prod_add.php?$query_string");
            exit();             

In the first code, the page only print the first $_GET[‘name_error’], while it should be include $_GET[‘date_error’] and $_GET[‘price_error. ‘]
This is the address:

http://example.com/prod_add.php?name_error=Product+name+must+be+characters+only&date_error=Product+date+must+be+input+as+this+formate+DD-MM-YYYY&price_error=Product+price+must+be+float+number+only

  • 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-04T08:28:34+00:00Added an answer on June 4, 2026 at 8:28 am

    You should use & instead of &amp;‘s ?

    $query_string = "name_error=" .urlencode($name_error) ."&date_error=" .urlencode($date_error) ."&price_error=" .urlencode($price_error);
                header("Location: ./prod_add.php?$query_string");
                exit();   
    
    • 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 the string value Admin from a linq query, but
I am trying to get strpos to search string variable $string for the phrase
I am trying to created nested dictionary variable like the below, But I get
I'm trying to check a string passed through the URL and get back all
I'm trying to form a query string from multiple checkboxes that will be used
I'm trying to change a variable name in a query string, so it's usable
I've got a pretty long query string variable (value is approximately 600 chars) that
i am trying trying to get a query from oracle table called sys.all_objects into
hello iam trying to get the id from a url and send it to
I am trying to get jquery to pick up variable that I am defining

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.