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

  • Home
  • SEARCH
  • 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 8785735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:26:29+00:00 2026-06-13T21:26:29+00:00

Ok I almost got a dropdown pulling from my DB and posting to it

  • 0

Ok I almost got a dropdown pulling from my DB and posting to it as well to work. I got it to pull down the data and for it to submit to the DB. Still a stump. If I have example “ABC Trucking” as an option. It only posts “ABC” to table1. For whatever reason it doenst post two words? Any Ideas? See where the carriername dropdown is in the div.

My Code:

<?php

if (isset($_POST["submit"]) && $_POST["submit"] == "Submit")
{
    for ($count = 1; $count <= 9; $count++)
    {
        $fields[$count] = "";
        if (isset($_POST["field" . $count . ""]))
        {
            $fields[$count] = trim($_POST["field" . $count . ""]);
            //echo $fields[$count] . "<br />";
        }
    }

    $con = mysql_connect("local", "user", "pass");
    mysql_select_db("DB", $con);

    $carriername = mysql_real_escape_string($_POST['carriername']);
    $fromzip = mysql_real_escape_string($_POST['fromzip']);
    $tozip = mysql_real_escape_string($_POST['tozip']);
    $typeofequipment = mysql_real_escape_string($_POST['typeofequipment']);
    $weight = mysql_real_escape_string($_POST['weight']);
    $length = mysql_real_escape_string($_POST['length']);
    $paymentamount = mysql_real_escape_string($_POST['paymentamount']);
    $contactperson = mysql_real_escape_string($_POST['contactperson']);
    $loadtype = mysql_real_escape_string($_POST['loadtype']);

    $insert = "INSERT INTO table1 (`carriername` ,`fromzip` ,`tozip` ,`typeofequipment` ,`weight` ,`length` ,`paymentamount` ,`contactperson` ,`loadtype`) VALUES('$carriername' ,'$fromzip' ,'$tozip' ,'$typeofequipment' ,'$weight' ,'$length' ,'$paymentamount' ,'$contactperson' ,'$loadtype');";
    mysql_query($insert) or die(mysql_error());

    $select = "SELECT `carriername` ,`fromzip` ,`tozip` ,`typeofequipment` ,`weight` ,`length` ,`paymentamount` ,`contactperson` ,`loadtype` FROM `table1` ORDER BY `paymentamount` DESC;";
    $result = mysql_query($select) or die(mysql_error());
}
?>
</script>
<style ="text-align: center; margin-left: auto; margin-right: auto;"></style>
</head>
<body>
<div
 style="border: 2px solid rgb(0, 0, 0); margin: 16px 20px 20px; width: 400px; background-color: rgb(236, 233, 216); text-align: center; float: left;">
<form action="" method="post";">
  <div
  style="margin: 8px auto auto; width: 300px; font-family: arial; text-align: left;"><br>
  <table style="font-weight: normal; width: 100%; font-size: 12px;"
 border="1" bordercolor="#929087" cellpadding="6" cellspacing="0">
   <table
 style="font-weight: normal; width: 100%; text-align: right; font-size: 12px;"
 border="1" bordercolor="#929087" cellpadding="6" cellspacing="0">
    <tbody>
    <tr>
    <td style="width: 10%;">Carrier:</td><td>
 <?php  

$con = mysql_connect("local", "user", "pass");
    mysql_select_db("DB", $con);

$query=("SELECT * FROM table2"); 

$result=mysql_query($query) or die ("Unable to Make the Query:" . mysql_error() ); 
echo "<select name=carriername>";   

while($row=mysql_fetch_array($result)){  

echo "<OPTION VALUE=".$row['carriername'].">".$row['carriername']."</OPTION>"; 
} 

echo "</select>";  


?>
              </td>
        </tr>
        <tr>
              <td style="width: 35%;">Pick Zip:</td><td> <input id="fromzip" name="fromzip" maxlength="50"
 style="width: 100%;" type="text">
        </tr>
        <tr>
              <td style="width: 35%;">Drop Zip:</td><td> <input id="tozip" name="tozip" maxlength="50"
 style="width: 100%;" type="text">
        </tr>
        <tr>
              <td style="width: 35%;">Load Type:</td><td> <input id="loadtype" name="loadtype" maxlength="50"
 style="width: 100%;" type="text">
        </tr>
        <tr>
              <td style="width: 35%;">Rate:</td><td> <input id="paymentamount" name="paymentamount" maxlength="50"
 style="width: 100%;" type="text">
        </tr>
          </tbody>
  </table>
  <p style="text-align: center;"><input name="submit" value="Submit"
 class="submit" type="submit"></p>
  </div>
</form>
</div>
<p style="margin-bottom: -20px;">&nbsp;</p>
</body>
  • 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-13T21:26:30+00:00Added an answer on June 13, 2026 at 9:26 pm

    instead of :

    echo "<OPTION VALUE=".$row['carriername'].">".$row['carriername']."</OPTION>";
    

    use this

    echo "<OPTION VALUE='".$row['carriername']."'>".$row['carriername']."</OPTION>";
    

    notice ‘ in ur value…concate ” to your value attr.. so that it makes it a string….

    EDITED

    echo "<select name='carriername'>";   
    while($row=mysql_fetch_array($result)){  
      echo "<OPTION VALUE=".$row['carriername'].">".$row['carriername']."</OPTION>"; 
    } 
    echo "</select>";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some problems building an hierarchistic array structure - I have almost got
I got this code from someone, it's almost perfect to create a dynamic breadcrumb,
I've almost got this working apart from one little annoying thing... Because the ListBox
I've almost got it, but it doesn't quite work. I'm trying to load the
I created a custom browser from the WebKit framework. I almost got everything setup.
Hi i almost got everything ,but i dont know whats wrong. i have two
Okay, I've almost got this thing finished! Many thanks to all who have helped
I think I've almost got it, but not there quite... I want to select
I'm dangerously close to launching a pretty heavy web app and I've got almost
I got a RSA pubkey.dat (almost obvious what it is) that has the following

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.