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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:29:37+00:00 2026-06-15T23:29:37+00:00

Is there a way to keep passing a value, submitted in the first (or

  • 0

Is there a way to keep passing a value, submitted in the first (or earlier) dropdown select form to succeeding processing codes/files– AFTER THE FIRST PROCESSING FILE?

Here’s what I’m trying to do: I’ve created a db for footwear (size, type, style tables), then I created a lookup table called “syle_in_size” that has size relative to style. The idea is for queries to start from this table so that everything is based on the SIZE that the user selects at the beginning of the search. From there, the SPECIFIC footwear (size, style then type) will be determined.

So I came up with code that passes from one dropdown/ option table to another (I know, different pages*** I’ve seen advise and pages that do it all in one page but I want to do it in succession—partly as a design element and also because I do not know javascript since I only started with programming a few months ago–just one language at a time).

Here’s what I have:

SIZE Table

+--------+------+
| sizeid | size |
+--------+------+
|    7.0 |  7.0 |
|    7.5 |  7.5 |
|    9.0 |  9.0 |
|    9.5 |  9.5 |
|   11.0 | 11.0 |
+--------+------+

TYPE Table

+--------+---------+
| typeid | type    |
+--------+---------+
|      1 | Shoes   |
|      2 | Boots   |
|      3 | Sandals |
+--------+---------+

STYLE Table

+---------+--------+------------+
| styleid | typeid | style      |
+---------+--------+------------+
|       1 |      1 | Athletic   |
|       2 |      1 | Lace-up    |
|       3 |      1 | Loafers    |
|       4 |      1 | Moccasins  |
|       5 |      2 | Combat     |
|       6 |      2 | Hiking     |
|       7 |      2 | Riding     |
|       8 |      3 | Flip Flops |
|       9 |      3 | Slide      |
+---------+--------+------------+

STYLE_IN_SIZE Table

+---------------+--------+---------+
| sizeinstyleid | sizeid | styleid |
+---------------+--------+---------+
|             1 |    7.0 |       1 |
|             2 |    7.5 |       1 |
|             3 |   11.0 |       1 |
|             4 |    7.5 |       2 |
|             5 |    9.0 |       2 |
|             6 |    7.5 |       3 |
|             7 |   11.0 |       3 |
|             8 |    7.0 |       4 |
|             9 |    7.5 |       4 |
|            10 |    9.0 |       4 |
|            11 |   11.0 |       5 |
|            12 |    9.0 |       6 |
|            13 |   11.0 |       6 |
|            14 |    7.5 |       7 |
|            15 |    9.0 |       7 |
|            16 |   11.0 |       7 |
|            17 |    7.5 |       8 |
|            18 |    9.0 |       8 |
|            19 |   11.0 |       8 |
|            20 |    7.0 |       9 |
+---------------+--------+---------+

First page: SELECT_SIZE.php

<?php

$con = mysql_connect("localhost", "xxxxx", "xxxxx") or die('Could not connect to server');
mysql_select_db("footwear", $con) or die('Could not connect to database');

echo "<form action=\"select_type.php\" method=\"get\">\n";

echo "<select name=\"size\">\n";

$query="SELECT sizeid,size FROM size WHERE sizeid";

$result=mysql_query($query);

      while($row=mysql_fetch_array($result,MYSQL_ASSOC))

      {
          $sizeid= $row['sizeid'];
          $size= $row['size'];
          echo "<option value=\"$sizeid\">$size</option>";

      }

      echo "</select>\n";
      echo "<input name=\"submit\" type=\"submit\" id=\"sizeid\" value=\"submit\" />\n";
      echo "</form> \n";

?>

First Processing page: SELECT_STYLE.php
After user selects size, code looks for all footwear type only available in that size. You’ll notice there are none in 9.5–that’s my little test.

<?php

$con = mysql_connect("localhost", "xxxxx", "xxxxx") or die('Could not connect to server');
mysql_select_db("footwear", $con) or die('Could not connect to database');

$sizeid= $_GET['sizeid'];
$size= $_GET['size'];

$query="SELECT sizeid,size FROM size WHERE sizeid=$size";

$result = mysql_query($query) or die(mysql_error());

$row = mysql_fetch_array($result, MYSQL_ASSOC) or die(mysql_error());

$sizeid= $row['sizeid'];
$size= $row['size'];

{
echo "<form action=\"select_style.php\" method=\"get\">\n";

echo "<select name=\"type\">\n";

$query="SELECT DISTINCT type.typeid, type, style_in_size.sizeid FROM style_in_size, type, style, size
WHERE style_in_size.sizeid=$sizeid
AND style_in_size.styleid = style.styleid
AND style.typeid= type.typeid
GROUP BY type";

      $result=mysql_query($query);

      while($row=mysql_fetch_array($result,MYSQL_ASSOC))

      {

          $sizeid = $row['sizeid'];
          $size= $row['size'];
          $typeid = $row['typeid'];
          $type=$row['type'];

          echo "<option value=\"$typeid\" \"$sizeid\">$type $sizeid</option>";
//I want only the "type" /$type to show in the dropdown but included SIZE for now to see if it would help pass the value to the next page
      }

      echo "</select>\n";
      echo "<input name=\"submit\" type=\"submit\" id=\"typeid\" value=\"submit\" />\n";

      echo "</form> \n";
}

?>

Passes on to this page where I want to show type and size (for now, because I want to create another dropdown for style BASED ON SIZE. But if I can’t get size to show up on this page then I can’t proceed)
SELECT_STYLE.php

<?php


$con = mysql_connect("localhost", "xxxxx", "xxxxx") or die('Could not connect to server');
mysql_select_db("footwear", $con) or die('Could not connect to database');

$sizeid = $_GET['sizeid'];
$size= $_GET['size'];
$typeid = $_GET['typeid'];
$type=$_GET['type'];


$query = "SELECT  type, style_in_size.sizeid FROM size, type, style, style_in_size
WHERE type.typeid=$type
AND style_in_size.styleid = style.styleid
AND style.typeid= type.typeid
AND style_in_size.sizeid = size.sizeid";

$result = mysql_query($query) or die(mysql_error());

$row = mysql_fetch_array($result, MYSQL_ASSOC) or die(mysql_error());

$sizeid = $row['sizeid'];
$size= $row['size'];
$typeid = $row['typeid'];
$type=$row['type'];

{
    echo "You've chosen $type in size $size ";
}

?>

If I select “Sandals”, the preceding code only displays “You’ve chosen Sandals in ” ; size does not show/ was not passed.

I’ve tried the following but nothing works:

$query = "SELECT  type.typeid, type, style_in_size.sizeid FROM size, type, style, style_in_size
WHERE type.typeid=$type
AND sizeid = $sizeid
AND size.sizeid = style_in_size.sizeid
AND style_in_size.styleid = style.styleid
AND style.typeid= type.typeid";

Also:

$query = "SELECT  type.typeid, type, style_in_size.sizeid FROM size, type, style, style_in_size
WHERE style_in_size.sizeid = $sizeid
AND size.sizeid = style_in_size.sizeid
AND style_in_size.styleid = style.styleid
AND style.typeid= type.typeid
AND typeid=$type"; 

I hope I’ve written my question in a manner that makes sense.
Your help and input are greatly appreciated.
Thanks in advance.

  • 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-15T23:29:38+00:00Added an answer on June 15, 2026 at 11:29 pm

    Considering you’re doing this over multiple pages the best solution is probably to make use sessions (see here).

    When you get, say, the size you can store this in the session:

    $_SESSION['size'] = $size;
    

    In later pages you can retrieve this:

    $sizeFromAPreviousPage = $_SESSION['size'];
    

    (Note: Make sure you call session_start() at the start of pages using sessions).

    Also as Charles mentioned you should take steps to prevent SQL Injection. the mysql_* are now deprecated.

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

Sidebar

Related Questions

Is there a way to keep a window inactive looking, even if it contains
Is there any way to keep this simple JQuery animation from flashing? http://jsfiddle.net/v3DVf/6/
Is there a way to keep any DLLs needed for my Visual C# program
Is there a way to keep MSMQ outgoing queues on a server in state
Is there any way to keep track the state of a UIButton whether it
Is there a good way to keep keys from conflicting when using the Microsoft
Is there a good way to keep consistency in the $_GET For example if
I am wondering if there is any way to keep the indentation with jinja
I would like to know if there is a way to keep the session
Is there a straight forward way to keep track of game time in Android

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.