Jump to content

Search the Community

Showing results for tags 'dependable'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hello all! First, im very new to this forum.. and i'm really liking it! Second, i'm having this problem. I created this php dropdown menu allowing a user to select a specific phone make, model, color, size, and condition. However, when i run the script i only get the two makes i initialize within the code "Apple" and "Samsung." Can someone take a look at my code and see if its the issue? My back end looks like so: Database name: model MODEL_ID int(11) Key - Auto increment MAKE_ID int(11) MODEL_NAME varchar(30) Database name: color COLOR_ID int(11) Key - Auto increment MODEL_ID int(2) COLOR_NAME varchar(20) Database name: size SIZE_ID int(11) Key -Auto increment COLOR_ID int(2) SIZE_NAME varchar(40) Database name: con CON_ID int(11) Key -Auto increment SIZE_ID int(2) CON_NAME varchar(20) <?php # FileName="Connection_php_mysql.htm" # Type="MYSQL" # HTTP="true" $hostname_custsqlmoo16 = ""; $database_custsqlmoo16 = ""; $username_custsqlmoo16 = ""; $password_custsqlmoo16 = ""; $custsqlmoo16 = mysql_pconnect($hostname_custsqlmoo16, $username_custsqlmoo16, $password_custsqlmoo16) or trigger_error(mysql_error(),E_USER_ERROR); ?> <?php $make = $model = $color = $size = $con = null; //declare vars $conn = mysql_connect('localhost'); $db = mysql_select_db('testing',$conn); if(isset($_GET["make"]) && is_numeric($_GET["make"])) { $make = $_GET["make"]; } if(isset($_GET["model"]) && is_numeric($_GET["model"])) { $model = $_GET["model"]; } if(isset($_GET["color"]) && is_numeric($_GET["color"])) { $color = $_GET["color"]; } if(isset($_GET["size"]) && is_numeric($_GET["size"])) { $size = $_GET["size"]; } if(isset($_GET["con"]) && is_numeric($_GET["con"])) { $con = $_GET["con"]; } ?> <script language="Javascript"> function autoSubmit() { var formObject = document.forms['theForm']; formObject.submit(); } </script> <form name="theForm" method="get"> <select name="make" onchange="autoSubmit();"> <option value="null"></option> <option value="1" <?php if($make == 1) echo " selected"; ?>>Apple</option> <option value="2" <?php if($make == 2) echo " selected"; ?>>Samsung</option> </select> <br><br> <?php if($make != null && is_numeric($make)) { ?> <select name="model" onchange="autoSubmit();"> <option value="null"></option> <?php //POPULATE DROP DOWN MENU WITH model FROM A GIVEN make $sql = "SELECT MODEL_ID, MODEL_NAME FROM model WHERE MAKE_ID = $make"; $model = mysql_query($sql,$conn); while($row = mysql_fetch_array($model)) { echo ("<option value=\"$row[MODEL_ID]\" " . ($model == $row["MODEL_ID"] ? " selected" : "") . ">$row[MODEL_NAME]</option>"); } ?> </select> <?php } ?> <br><br> <?php if($model != null && is_numeric($model) && $make != null) { ?> <select name="color" onchange="autoSubmit();"> <option value="null"></option> <?php //POPULATE DROP DOWN MENU WITH COLORS FROM A GIVEN MAKE, MODEL $sql = "SELECT COLOR_ID, COLOR_NAME FROM color WHERE MODEL_ID = $model "; $color = mysql_query($sql,$conn); while($row = mysql_fetch_array($color)) { echo ("<option value=\"$row[color_ID]\" " . ($color == $row["COLOR_ID"] ? " selected" : "") . ">$row[color_NAME]</option>"); } ?> </select> <?php } ?> <br><br> <?php if($color != null && is_numeric($color) && $make != null && $model != null) { ?> <select name="size" onchange="autoSubmit();"> <option value="null"></option> <?php //POPULATE DROP DOWN MENU WITH SIZES FROM A GIVEN MAKE, MODEL, COLOR $sql = "SELECT SIZE_ID, SIZE_NAME FROM SIZE WHERE COLOR_ID = $color "; $size = mysql_query($sql,$conn); while($row = mysql_fetch_array($size)) { echo ("<option value=\"$row[size_ID]\" " . ($size == $row["SIZE_ID"] ? " selected" : "") . ">$row[size_NAME]</option>"); } ?> </select> <?php } ?> <br><br> <?php if($size != null && is_numeric($size) && $make != null && $model != null && $color != null) { ?> <select name="con" onchange="autoSubmit();"> <option value="null"></option> <?php //POPULATE DROP DOWN MENU WITH CONDITIONS FROM A GIVEN MAKE, MODEL, COLOR, SIZE $sql = "SELECT CON_ID, CON_NAME FROM CON WHERE SIZE_ID = $size "; $con = mysql_query($sql,$conn); while($row = mysql_fetch_array($con)) { echo ("<option value=\"$row[CON_ID]\" " . ($con == $row["CON_ID"] ? " selected" : "") . ">$row[CON_NAME]</option>"); } ?> </select> <?php } ?> </form> Thanks ahead of time!
×
×
  • 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.