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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:34:50+00:00 2026-06-04T16:34:50+00:00

i have a little problem while getting a value from database and post it

  • 0

i have a little problem while getting a value from database and post it to another page , heres my code . on search.php the user enter the price min and price max , then on page result.php it shows from database the name and price of the product and a link for more infos .(info.php) this 3rd page will show some additional informations based on the Id of the product shown on result.php
i tried to hide the value of Id_product from result and post it to 3rd form but doesnt work.i got an error Notice: Undefined index: id in info.php line 4

//////search.php /////

<form  method="post" action="result.php" > 
<tr> <INPUT type=text size=20 name=pricemin ><BR>  </tr>  
<tr> <INPUT type=text size=20 name=pricemax ><BR>  </tr>
<tr> <input type="submit" class="Nom" id="button" value="Valider" /></tr></form>

///////result.php //////

<?php include 'includes/connection.php';
$pricemin = $_POST['pricemin'];
$pricemax = $_POST['pricemax'];
$query = "SELECT * FROM product where price between '$pricemin' and '$pricemax'";
$result = mysql_query($query);?>
<?php if(mysql_num_rows($result) > 0)
while($products = mysql_fetch_array($result)) {?>   
<?php echo $products['name_product'] ;echo $products['price_product'] ;
echo "<a href='http://localhost/mywebsite/info.php'>More infos</a>"
?>
<form method="post" action="info.php" >
<input type="hidden" name="id" value="<?php echo $products['id_product']; ?>" />
</form><?php } ?>...

///// info.php //////

<?php
include 'includes/connection.php';
$id_product = $_POST['id'];
$query = "SELECT * FROM product where id_product='$id_product'";
$result = mysql_query($query);   ?>
<html><head><title>.. </title></head><body>
<?php 
while($products = mysql_fetch_array($result)) {?>
<h1>Product ID : <?php echo  $products['id_product'] ; ?> </h1>
<h1>Product name : <?php echo  $products['name_product'] ; ?> </h1>
<h1>Product Qt : <?php echo  $products['quantity_product'] ; ?> </h1>
<h1>Product Spec : <?php echo  $products['spec_product'] ; ?> </h1>
<?php } ?></body></html>
  • 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-04T16:34:51+00:00Added an answer on June 4, 2026 at 4:34 pm

    try this:

    //////search.php /////
    
    <form  method="post" action="result.php" > 
    <tr> <INPUT type=text size=20 name=pricemin ><BR>  </tr>  
    <tr> <INPUT type=text size=20 name=pricemax ><BR>  </tr>
    <tr> <input type="submit" class="Nom" id="button" value="Valider" /></tr></form>
    
    ///////result.php //////
    
    <?php include 'includes/connection.php';
    $pricemin = $_POST['pricemin '];
    $pricemax = $_POST['pricemax '];
    $query = "SELECT * FROM product where price between '".$pricemin."' and '".$pricemax."'";
    $result = mysql_query($query);
    
    if(mysql_num_rows($result) > 0)
    while($products = mysql_fetch_array($result)) {
    $id = $products['id_product'];
    echo $products['name_product'] ;echo $products['price_product'] ;
    echo "<a href='info.php?id=";
    echo $id;
    echo "'>More infos</a>"
    ?>
    
    <?php } ?>...
    
    ///// info.php //////
    
    <?php
    include 'includes/connection.php';
    $id_product = $_GET['id'];
    $query = "SELECT * FROM bien where id_product= '".$id_product."'";
    $result = mysql_query($query);   ?>
    <html><head><title>.. </title></head><body>
    <?php 
    while($products = mysql_fetch_array($result)) {?>
    <h1>Product ID : <?php echo  $products['id_product'] ; ?> </h1>
    <h1>Product name : <?php echo  $products['name_product'] ; ?> </h1>
    <h1>Product Qt : <?php echo  $products['quantity_product'] ; ?> </h1>
    <h1>Product Spec : <?php echo  $products['spec_product'] ; ?> </h1>
    <?php } ?></body></html>
    

    this should pass ID to info.php

    Also Form will only work if you submit a button, so if you were to click a link, form will not submit unless you use a JS onsubmit function.

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

Sidebar

Related Questions

I have a little problem with getting the elements in my sqlite database in
I'm have little problem in retrieving the data from a table here's the code:
i have little bit of problem while working with External entity reference in External
I have little problem with a replacement of a little part in an url.
I have little problem in regular expressin creation. Expected input: blahblahblah, blahblahblah, 'blahblahblah', blahblahblah,
I have a little problem with a simple vbScript. The script has to run
I have a little problem with some jquery and http://www.mikage.to/jquery/jquery_history_noc.html The function works great,
I have a little problem where I would like to insert a svn diff
I have this little problem, that I cannot figure out which arguments to pass
I have a little problem with a query. I'm selecting data using the between

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.