Jump to content

Recommended Posts

I have a form that is submitting to a database currently.  I would like to check the data and be able to update it with a notes section. 

 

The form is currently 80 text boxes, dropdowns, and text areas being submitted to the database.  I need this info to populate after the user id is entered and a button is pressed.  I will have to update this page frequently with notes.  I am going to create a new table just for the notes  and will attach the customer id to it also.

 

If you can help me out with this i would appricate it.  I can post my current code or an example of the code.

Link to comment
https://forums.phpfreaks.com/topic/224462-php-pull-database-table-into-html-form/
Share on other sites

here is some of the code from my form:

 

<form action="submit.php" method="post">
      <table width="1048" border="0" align="center">
        <tr>
    <td width="170" align="center">Business Name</td>
    <td width="210" align="center">Contact First Name</td>
    <td width="220" align="center">Contact Last Name</td>
    <td width="3"> </td>
    <td width="221" align="center">Business Email</td>
    <td width="216" align="center">Business Phone</td>
  </tr>
  <tr>
    <td align="center">
      <input name="bus_name" type="text" id="bus_name" size="30" />
    </td>
    <td align="center">
      <input type="text" name="contact_fname" id="contact_fname" />
    </td>
    <td align="center">
      <input type="text" name="contact_lname" id="contact_lname" />
    </td>
    <td> </td>
    <td align="center">
      <input type="text" name="bus_email" id="bus_email" />
    </td>
    <td align="center">
      <input type="text" name="bus_phone" id="bus_phone" />
    </td>
  </tr>
  <tr>
    <td colspan="2" align="center">Business Address</td>
    <td align="center">Business City</td>
    <td> </td>
    <td align="center">Business State</td>
    <td align="center">Business Zip</td>
  </tr>
  <tr>
    <td colspan="2" align="center">
      <div align="left">
        <input name="bus_address" type="text" id="bus_address" size="45" />
    </div></td>
    <td align="center">
      <input type="text" name="bus_city" id="bus_city" />
    </td>
    <td> </td>
    <td align="center">
      <input type="text" name="bus_state" id="bus_state" />
    </td>
    <td align="center">
      <input type="text" name="bus_zip" id="bus_zip" />
    </td>
  </tr>
  <tr>
    <td>Website URL</td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td>Business Tag Line</td>
    <td> </td>
  </tr>
  <tr>
    <td colspan="2"><input name="bus_url" type="text" id="bus_url" size="50" /></td>
    <td> </td>
    <td> </td>
    <td colspan="2"><input name="bus_tagline" type="text" id="bus_tagline" value="" size="40" maxlength="140" /></td>
  </tr>
  <tr>
    <td> </td>
    <td colspan="2" align="center">Business Description Code (BDC)</td>
    <td> </td>
    <td colspan="2" align="center">Business Listing Code (BLC)</td>
    </tr>
  <tr>
    <td class="right"> </td>
    <td align="center">Name</td>
    <td align="center">Code</td>
    <td> </td>
    <td align="center">Name</td>
    <td align="center">Code</td>
  </tr>
  <tr>
    <td class="right">Business Category 1</td>
    <td align="center">
      <input name="bdc_cat1" type="text" id="bdc_cat1" size="30" />
    </td>
    <td align="center">
      <input name="bdc1" type="text" id="bdc1" size="30" />
    </td>
    <td> </td>
    <td align="center"><input name="blc_cat1" type="text" id="blc_cat1" size="30" /></td>
    <td align="center"><input name="blc1" type="text" id="blc1" size="30" /></td>
  </tr>
  <tr>
    <td class="right">Business Category 2</td>
    <td align="center">
      <input name="bdc_cat2" type="text" id="bdc_cat2" size="30" />
    </td>
    <td align="center">
      <input name="bdc2" type="text" id="bdc2" size="30" />
    </td>
    <td> </td>
    <td align="center"><input name="blc_cat2" type="text" id="blc_cat2" size="30" /></td>
    <td align="center"><input name="blc2" type="text" id="blc2" size="30" /></td>
  </tr>
  <tr>
    <td class="right">Business Category 3</td>
    <td align="center">
      <input name="bdc_cat3" type="text" id="bdc_cat3" size="30" />
    </td>
    <td align="center">
      <input name="bdc3" type="text" id="bdc3" size="30" />
    </td>
    <td> </td>
    <td align="center"><input name="blc_cat3" type="text" id="blc_cat3" size="30" /></td>
    <td align="center"><input name="blc3" type="text" id="blc3" size="30" /></td>
  </tr>
  <tr>
    <td class="right">Business Category 4</td>
    <td align="center">
      <input name="bdc_cat4" type="text" id="bdc_cat4" size="30" />
    </td>
    <td align="center">
      <input name="bdc4" type="text" id="bdc4" size="30" />
    </td>
    <td> </td>
    <td align="center"><input name="blc_cat4" type="text" id="blc_cat4" size="30" /></td>
    <td align="center"><input name="blc4" type="text" id="blc4" size="30" /></td>
  </tr>
  <tr>
    <td class="right">Business Category 5</td>
    <td align="center">
      <input name="bdc_cat5" type="text" id="bdc_cat5" size="30" />
    </td>
    <td align="center">
      <input name="bdc5" type="text" id="bdc5" size="30" />
    </td>
    <td> </td>
    <td align="center"><input name="blc_cat5" type="text" id="blc_cat5" size="30" /></td>
    <td align="center"><input name="blc5" type="text" id="blc5" size="30" /></td>
  </tr>
  <tr>
    <td class="right">Business Category 6</td>
    <td align="center">
      <input name="bdc_cat6" type="text" id="bdc_cat6" size="30" />
    </td>
    <td align="center">
      <input name="bdc6" type="text" id="bdc6" size="30" />
    </td>
    <td> </td>
    <td align="center"><input name="blc_cat6" type="text" id="blc_cat6" size="30" /></td>
    <td align="center"><input name="blc6" type="text" id="blc6" size="30" /></td>
  </tr>
  <tr>
    <td colspan="6">Business Description (Use Business Description Writing Tool, then Copy and Paste) (900 max. characters)</td>
  </tr>
  <tr>
    <td colspan="6">
      <textarea name="bus_desc" id="bus_desc" cols="150" rows="6"></textarea>
    </td>
  </tr>
  <tr>
    <td colspan="3">Business Services Offered</td>
    <td> </td>
    <td colspan="2">Brands Offered</td>
  </tr>
  <tr>
    <td colspan="3">
      <textarea name="bus_services" id="bus_services" cols="80" rows="5"></textarea>
    </td>
    <td> </td>
    <td colspan="2">
      <textarea name="brands_offered" id="brands_offered" cols="60" rows="5"></textarea>
    </td>
  </tr>
  <tr>
    <td colspan="3"><p>** Key Words ** <span class="style10">(Use words and/phrases the consumer would use) (900 max. characters)</span></p></td>
    <td> </td>
    <td class="right">Language 1</td>
    <td>
      <input type="text" name="language1" id="language1" />
    </td>
  </tr>
  <tr>
    <td colspan="3" rowspan="7"><textarea name="textarea" id="textarea" cols="80" rows="10"></textarea></td>
    <td> </td>
    <td class="right">Language 2</td>
    <td>
      <input type="text" name="language2" id="language2" />
    </td>
  </tr>
  <tr>
    <td> </td>
    <td class="right">Language 3</td>
    <td>
      <input type="text" name="language3" id="language3" />
    </td>
  </tr>
  <tr>
    <td> </td>
    <td class="right">Year Established</td>
    <td>
      <select id="year" name="year">
      <option selected="selected">Select Year</option>
      <option value="2011">2011</option>
      <option value="2010">2010</option>
      <option value="2009">2009</option>
      <option value="2008">2008</option>
      <option value="2007">2007</option>
      <option value="2006">2006</option>
      <option value="2005">2005</option>
      <option value="2004">2004</option>
      <option value="2003">2003</option>
      <option value="2002">2002</option>
      <option value="2001">2001</option>
      <option value="2000">2000</option>
      <option value="1999">1999</option>
      <option value="1998">1998</option>
      <option value="1997">1997</option>
      <option value="1996">1996</option>
      <option value="1995">1995</option>
      <option value="1994">1994</option>
      <option value="1993">1993</option>
      <option value="1992">1992</option>
      <option value="1991">1991</option>
      <option value="1990">1990</option>
      <option value="1989">1989</option>
      <option value="1988">1988</option>
      <option value="1987">1987</option>
      <option value="1986">1986</option>
      <option value="1985">1985</option>
      <option value="1984">1984</option>
      <option value="1983">1983</option>
      <option value="1982">1982</option>
      <option value="1981">1981</option>
      <option value="1980">1980</option>
      <option value="1979">1979</option>
      <option value="1978">1978</option>
      <option value="1977">1977</option>
      <option value="1976">1976</option>
      <option value="1975">1975</option>
      <option value="1974">1974</option>
      <option value="1973">1973</option>
      <option value="1972">1972</option>
      <option value="1971">1971</option>
      <option value="1970">1970</option>
      <option value="1969">1969</option>
      <option value="1968">1968</option>
      <option value="1967">1967</option>
      <option value="1966">1966</option>
      <option value="1965">1965</option>
      <option value="1964">1964</option>
      <option value="1963">1963</option>
      <option value="1962">1962</option>
      <option value="1961">1961</option>
      <option value="1960">1960</option>
      <option value="1959">1959</option>
      <option value="1958">1958</option>
      <option value="1957">1957</option>
      <option value="1956">1956</option>
      <option value="1955">1955</option>
      <option value="1954">1954</option>
      <option value="1953">1953</option>
      <option value="1952">1952</option>
      <option value="1951">1951</option>
      <option value="1950">1950</option>
      <option value="1949">1949</option>
      <option value="1948">1948</option>
      <option value="1947">1947</option>
      <option value="1946">1946</option>
      <option value="1945">1945</option>
      <option value="1944">1944</option>
      <option value="1943">1943</option>
      <option value="1942">1942</option>
      <option value="1941">1941</option>
      <option value="1940">1940</option>
      <option value="1939">1939</option>
      <option value="1938">1938</option>
      <option value="1937">1937</option>
      <option value="1936">1936</option>
      <option value="1935">1935</option>
      <option value="1934">1934</option>
      <option value="1933">1933</option>
      <option value="1932">1932</option>
      <option value="1931">1931</option>
      <option value="1930">1930</option>
      <option value="1929">1929</option>
      <option value="1928">1928</option>
      <option value="1927">1927</option>
      <option value="1926">1926</option>
      <option value="1925">1925</option>
      <option value="1924">1924</option>
      <option value="1923">1923</option>
      <option value="1922">1922</option>
      <option value="1921">1921</option>
      <option value="1920">1920</option>
      <option value="1919">1919</option>
      <option value="1918">1918</option>
      <option value="1917">1917</option>
      <option value="1916">1916</option>
      <option value="1915">1915</option>
      <option value="1914">1914</option>
      <option value="1913">1913</option>
      <option value="1912">1912</option>
      <option value="1911">1911</option>
      <option value="1910">1910</option>
      <option value="1909">1909</option>
      <option value="1908">1908</option>
      <option value="1907">1907</option>
      <option value="1906">1906</option>
      <option value="1905">1905</option>
      <option value="1904">1904</option>
      <option value="1903">1903</option>
      <option value="1902">1902</option>
      <option value="1901">1901</option>
      <option value="1900">1900</option>
      </select>
    </td>
  </tr>
  <tr>
    <td> </td>
    <td class="right"># or Employees</td>
    <td><label>
      <select name="employees" id="employees">
        <option selected="selected">Select # of Employees</option>
        <option value="1-10">1 - 10</option>
        <option value="11-20">11 - 20</option>
        <option value="21-50">21 - 50</option>
        <option value="51-100">51 - 100</option>
        <option value="100+">100+</option>
</select>
    </label></td>
  </tr>
  <tr>
    <td> </td>
    <td>Payment Types Accepted</td>
    <td> </td>
    </tr>
  <tr>
    <td> </td>
    <td class="right">Master Card</td>
    <td><select name="payment_mc" id="payment_mc">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td> </td>
    <td class="right">Visa</td>
    <td><select name="payment_visa" id="payment_visa">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td> </td>
    <td>Open</td>
    <td>Close</td>
    <td> </td>
    <td class="right">Discover</td>
    <td><select name="payment_discover" id="payment_discover">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td class="right">Monday</td>
    <td><select name="monday_open" id="monday_open">
      <option>6 am</option>
      <option>7 am</option>
      <option selected="selected">8 am</option>
      <option>9 am</option>
      <option>10 am</option>
      <option>11 am</option>
      <option>12 pm</option>
    </select></td>
    <td><select name="monday_close" id="monday_close">
      <option>1 pm</option>
      <option>2 pm</option>
      <option>3 pm</option>
      <option>4 pm</option>
      <option selected="selected">5 pm</option>
      <option>6 pm</option>
      <option>7 pm</option>
      <option>8 pm</option>
    </select></td>
    <td> </td>
    <td class="right">American Express</td>
    <td><select name="payment_amex" id="payment_amex">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td class="right">Tuesday</td>
    <td><select name="tuesday_open" id="tuesday_open">
      <option>6 am</option>
      <option>7 am</option>
      <option selected="selected">8 am</option>
      <option>9 am</option>
      <option>10 am</option>
      <option>11 am</option>
      <option>12 pm</option>
    </select></td>
    <td><select name="tuesday_close" id="tuesday_close">
      <option>1 pm</option>
      <option>2 pm</option>
      <option>3 pm</option>
      <option>4 pm</option>
      <option selected="selected">5 pm</option>
      <option>6 pm</option>
      <option>7 pm</option>
      <option>8 pm</option>
    </select></td>
    <td> </td>
    <td class="right">Check</td>
    <td><select name="payment_check" id="payment_check">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td class="right">Wednesday</td>
    <td><select name="wednesday_open" id="wednesday_open">
      <option>6 am</option>
      <option>7 am</option>
      <option selected="selected">8 am</option>
      <option>9 am</option>
      <option>10 am</option>
      <option>11 am</option>
      <option>12 pm</option>
    </select></td>
    <td><select name="wednesday_close" id="wednesday_close">
      <option>1 pm</option>
      <option>2 pm</option>
      <option>3 pm</option>
      <option>4 pm</option>
      <option selected="selected">5 pm</option>
      <option>6 pm</option>
      <option>7 pm</option>
      <option>8 pm</option>
    </select></td>
    <td> </td>
    <td>Discounts Offered</td>
    <td> </td>
    </tr>
  <tr>
    <td class="right">Thursday</td>
    <td><select name="thrusday_open" id="thrusday_open">
      <option>6 am</option>
      <option>7 am</option>
      <option selected="selected">8 am</option>
      <option>9 am</option>
      <option>10 am</option>
      <option>11 am</option>
      <option>12 pm</option>
    </select></td>
    <td><select name="thrusday_close" id="thrusday_close">
      <option>1 pm</option>
      <option>2 pm</option>
      <option>3 pm</option>
      <option>4 pm</option>
      <option selected="selected">5 pm</option>
      <option>6 pm</option>
      <option>7 pm</option>
      <option>8 pm</option>
    </select></td>
    <td> </td>
    <td class="right">Senior Discount</td>
    <td><select name="senior_discount" id="senior_discount">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td class="right">Friday</td>
    <td><select name="friday_open" id="friday_open">
      <option>6 am</option>
      <option>7 am</option>
      <option selected="selected">8 am</option>
      <option>9 am</option>
      <option>10 am</option>
      <option>11 am</option>
      <option>12 pm</option>
    </select></td>
    <td><select name="friday_close" id="friday_close">
      <option>1 pm</option>
      <option>2 pm</option>
      <option>3 pm</option>
      <option>4 pm</option>
      <option selected="selected">5 pm</option>
      <option>6 pm</option>
      <option>7 pm</option>
      <option>8 pm</option>
    </select></td>
    <td> </td>
    <td class="right">Child Discount</td>
    <td><select name="child_discount" id="child_discount">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td class="right">Saturday</td>
    <td><select name="saturday_open" id="saturday_open">
      <option>6 am</option>
      <option>7 am</option>
      <option selected="selected">8 am</option>
      <option>9 am</option>
      <option>10 am</option>
      <option>11 am</option>
      <option>12 pm</option>
      <option>Closed</option>
    </select></td>
    <td><select name="saturday_close" id="saturday_close">
      <option>1 pm</option>
      <option>2 pm</option>
      <option>3 pm</option>
      <option>4 pm</option>
      <option selected="selected">5 pm</option>
      <option>6 pm</option>
      <option>7 pm</option>
      <option>8 pm</option>
      <option>Closes</option>
    </select></td>
    <td> </td>
    <td class="right">AAA Discount</td>
    <td><select name="aaa_discount" id="aaa_discount">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td class="right">Sunday</td>
    <td><select name="sunday_open" id="sunday_open">
      <option>6 am</option>
      <option>7 am</option>
      <option>8 am</option>
      <option>9 am</option>
      <option>10 am</option>
      <option>11 am</option>
      <option>12 pm</option>
      <option selected="selected">Closed</option>
    </select></td>
    <td><select name="sunday_close" id="sunday_close">
      <option>1 pm</option>
      <option>2 pm</option>
      <option>3 pm</option>
      <option>4 pm</option>
      <option>5 pm</option>
      <option>6 pm</option>
      <option>7 pm</option>
      <option>8 pm</option>
      <option selected="selected">Closed</option>
    </select></td>
    <td> </td>
    <td class="right">AARP Discount</td>
    <td><select name="aarp_discount" id="aarp_discount">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td class="right">Open 24 Hours</td>
    <td><select name="allday" id="allday">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    <td> </td>
    <td> </td>
    <td class="right"><p>Military Discount</p></td>
    <td><select name="military_discount" id="military_discount">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td class="right">By Appointment</td>
    <td><select name="appointment" id="appointment">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    <td> </td>
    <td> </td>
    <td class="right">Chamber Member Discount</td>
    <td><select name="chamber_member" id="chamber_member">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td class="right"> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td class="right">BBB Member Discount</td>
    <td><select name="bbb_member" id="bbb_member">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td colspan="6"><table width="898" border="0">
      <tr class="center">
        <td>Sales Agent</td>
        <td>Set-Up Date</td>
        <td>Plan Option</td>
        <td>Merchant Account</td>
        <td>Monthly Price</td>
        <td>Set-Up Fee</td>
      </tr>
      <tr class="center">
        <td>
          <input type="text" name="sales_agent" id="sales_agent" />
        </td>
        <td>
          <input type="text" name="setup_date" id="setup_date" />
        </td>
        <td><select name="plan_option" id="plan_option">
          <option selected="selected">Select Plan</option>
          <option value="Basic">Basic ($199.95)</option>
          <option value="Standard">Standard ($249.95)</option>
          <option value="County">County ($299.95)</option>
          <option value="Metro">Metro ($499.95)</option>
        </select>
        </td>
        <td><label>
          <select name="merchant" id="merchant">
            <option>Yes (-$100.00)</option>
            <option selected="selected">No</option>
          </select>
        </label></td>
        <td><label>
          <input type="text" name="price_mo" id="price_mo" />
        </label></td>
        <td>
          <input type="text" name="setup_fee" id="setup_fee" />
        </td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan="6" align="right"><label>
      <input type="submit" name="Submit" id="Submit" value="Submit" />
    </label></td>
  </tr>
</table></form>

 

I have the insert working fine but i just dont know how i would get the same info back into this form or a form like it.

 

Eric

 

MOD Edit:

 . . . 

tags added.

here is my insert code

 

<?php
$con = mysql_connect("localhost","username","password");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("db_table", $con);

$sql="INSERT INTO database (bus_name, contact_fname, contact_lname, bus_email, bus_phone, bus_address, bus_city, bus_state, bus_zip, bus_url, bus_tagline, bdc_cat1, bdc_cat2, bdc_cat3, bdc_cat4, bdc_cat5, bdc_cat6, bdc1, bdc2, bdc3, bdc4, bdc5, bdc6, blc_cat1, blc_cat2, blc_cat3, blc_cat4, blc_cat5, blc_cat6, blc1, blc2, blc3, blc4, blc5, blc6, bus_desc, bus_services, brands_offered, textarea, year, employees, language1, language2, language3, payment_mc, payment_visa, payment_discover, payment_amex, payment_check, senior_discount, child_discount, aaa_discount, aarp_discount, military_discount, chamber_member, bbb_member, monday_open, monday_close, tuesday_open, tuesday_close, wednesday_open, wednesday_close, thrusday_open, thrusday_close, friday_open, friday_close, saturday_open, saturday_close, sunday_open, sunday_close, allday, appointment, sales_agent, setup_date, plan_option, merchant, price_mo, setup_fee)
VALUES
('$_POST[bus_name]',
	 '$_POST[contact_fname]',
	 '$_POST[contact_lname]',
	 '$_POST[bus_email]',
	 '$_POST[bus_phone]',
	 '$_POST[bus_address]',
	 '$_POST[bus_city]',
	 '$_POST[bus_state]',
	 '$_POST[bus_zip]',
	 '$_POST[bus_url]',
	 '$_POST[bus_tagline]',
	 '$_POST[bdc_cat1]',
	 '$_POST[bdc_cat2]',
	 '$_POST[bdc_cat3]',
	 '$_POST[bdc_cat4]',
	 '$_POST[bdc_cat5]',
	 '$_POST[bdc_cat6]',
	 '$_POST[bdc1]',
	 '$_POST[bdc2]',
	 '$_POST[bdc3]',
	 '$_POST[bdc4]',
	 '$_POST[bdc5]',
	 '$_POST[bdc6]',
	 '$_POST[blc_cat1]',
	 '$_POST[blc_cat2]',
	 '$_POST[blc_cat3]',
	 '$_POST[blc_cat4]',
	 '$_POST[blc_cat5]',
	 '$_POST[blc_cat6]',
	 '$_POST[blc1]',
	 '$_POST[blc2]',
	 '$_POST[blc3]',
	 '$_POST[blc4]',
	 '$_POST[blc5]',
	 '$_POST[blc6]',
	 '$_POST[bus_desc]',
	 '$_POST[bus_services]',
	 '$_POST[brands_offered]',
	 '$_POST[textarea]',
	 '$_POST[year]',
	 '$_POST[employees]',
	 '$_POST[language1]',
	 '$_POST[language2]',
	 '$_POST[language3]',
	 '$_POST[payment_mc]',
	 '$_POST[payment_visa]',
	 '$_POST[payment_discover]',
	 '$_POST[payment_amex]',
	 '$_POST[payment_check]',
	 '$_POST[senior_discount]',
	 '$_POST[child_discount]',
	 '$_POST[aaa_discount]',
	 '$_POST[aarp_discount]',
	 '$_POST[military_discount]',
	 '$_POST[chamber_member]',
	 '$_POST[bbb_member]',
	 '$_POST[monday_open]',
	 '$_POST[monday_close]',
	 '$_POST[tuesday_open]',
	 '$_POST[tuesday_close]',
	 '$_POST[wednesday_open]',
	 '$_POST[wednesday_close]',
	 '$_POST[thrusday_open]',
	 '$_POST[thrusday_close]',
	 '$_POST[friday_open]',
	 '$_POST[friday_close]',
	 '$_POST[saturday_open]',
	 '$_POST[saturday_close]',
	 '$_POST[sunday_open]',
	 '$_POST[sunday_close]',
	 '$_POST[allday]',
	 '$_POST[appointment]',
	 '$_POST[sales_agent]',
	 '$_POST[setup_date]',
	 '$_POST[plan_option]',
	 '$_POST[merchant]',
	 '$_POST[price_mo]',
	 '$_POST[setup_fee]')";

if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }
echo "1 record added";

mysql_close($con)
?> 

 

 

 

and here so far is my

 

my other php code for pulling data i just need to know how to make this work with the form from above

 

$result = mysql_query("SELECT * FROM tablename WHERE user_id='" . $_SESSION['userid'] . "'")
or die (mysql_error());

$row = mysql_fetch_array($result);

 

I have the user_id but i just haven't applied it to the insert statement as of yet or the first form.

 

Let me know if any of you can help.

 

Thanks

Here is my updated code

 

If you can help me with the next steps i would appreciate it.

 


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<?php 
$con = mysql_connect("localhost","username","password");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("database", $con);


$result = mysql_query("SELECT * FROM table WHERE user_id='" . $_SESSION['userid'] . "'")
or die (mysql_error());

$row = mysql_fetch_array($result);
?>
</head>

<body>
      <form action="" method="post">
      <table width="1048" border="0" align="center">
      <tr>
    <td colspan="2" align="center"><div align="right"> User ID: </div></td>
    <td width="220"> 
      <input name="userid" type="text" id="userid" size="10" />
    </td>
    <td width="3"> </td>
    <td width="221" align="center"></td>
    <td width="216" align="center"></td>
  </tr>
        <tr>
    <td width="170" align="center">Business Name</td>
    <td width="210" align="center">Contact First Name</td>
    <td width="220" align="center">Contact Last Name</td>
    <td width="3"> </td>
    <td width="221" align="center">Business Email</td>
    <td width="216" align="center">Business Phone</td>
  </tr>
  <tr>
    <td align="center">
      <input name="bus_name" type="text" id="bus_name" size="30" />
    </td>
    <td align="center">
      <input type="text" name="contact_fname" id="contact_fname" />
    </td>
    <td align="center">
      <input type="text" name="contact_lname" id="contact_lname" />
    </td>
    <td> </td>
    <td align="center">
      <input type="text" name="bus_email" id="bus_email" />
    </td>
    <td align="center">
      <input type="text" name="bus_phone" id="bus_phone" />
    </td>
  </tr>
  <tr>
    <td colspan="2" align="center">Business Address</td>
    <td align="center">Business City</td>
    <td> </td>
    <td align="center">Business State</td>
    <td align="center">Business Zip</td>
  </tr>
  <tr>
    <td colspan="2" align="center">
      <div align="left">
        <input name="bus_address" type="text" id="bus_address" size="45" />
    </div></td>
    <td align="center">
      <input type="text" name="bus_city" id="bus_city" />
    </td>
    <td> </td>
    <td align="center">
      <input type="text" name="bus_state" id="bus_state" />
    </td>
    <td align="center">
      <input type="text" name="bus_zip" id="bus_zip" />
    </td>
  </tr>
  <tr>
    <td>Website URL</td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td>Business Tag Line</td>
    <td> </td>
  </tr>
  <tr>
    <td colspan="2"><input name="bus_url" type="text" id="bus_url" size="50" /></td>
    <td> </td>
    <td> </td>
    <td colspan="2"><input name="bus_tagline" type="text" id="bus_tagline" value="" size="40" maxlength="140" /></td>
  </tr>
  <tr>
    <td> </td>
    <td colspan="2" align="center">Business Description Code (BDC)</td>
    <td> </td>
    <td colspan="2" align="center">Business Listing Code (BLC)</td>
    </tr>
  <tr>
    <td class="right"> </td>
    <td align="center">Name</td>
    <td align="center">Code</td>
    <td> </td>
    <td align="center">Name</td>
    <td align="center">Code</td>
  </tr>
  <tr>
    <td class="right">Business Category 1</td>
    <td align="center">
      <input name="bdc_cat1" type="text" id="bdc_cat1" size="30" />
    </td>
    <td align="center">
      <input name="bdc1" type="text" id="bdc1" size="30" />
    </td>
    <td> </td>
    <td align="center"><input name="blc_cat1" type="text" id="blc_cat1" size="30" /></td>
    <td align="center"><input name="blc1" type="text" id="blc1" size="30" /></td>
  </tr>
  <tr>
    <td class="right">Business Category 2</td>
    <td align="center">
      <input name="bdc_cat2" type="text" id="bdc_cat2" size="30" />
    </td>
    <td align="center">
      <input name="bdc2" type="text" id="bdc2" size="30" />
    </td>
    <td> </td>
    <td align="center"><input name="blc_cat2" type="text" id="blc_cat2" size="30" /></td>
    <td align="center"><input name="blc2" type="text" id="blc2" size="30" /></td>
  </tr>
  <tr>
    <td class="right">Business Category 3</td>
    <td align="center">
      <input name="bdc_cat3" type="text" id="bdc_cat3" size="30" />
    </td>
    <td align="center">
      <input name="bdc3" type="text" id="bdc3" size="30" />
    </td>
    <td> </td>
    <td align="center"><input name="blc_cat3" type="text" id="blc_cat3" size="30" /></td>
    <td align="center"><input name="blc3" type="text" id="blc3" size="30" /></td>
  </tr>
  <tr>
    <td class="right">Business Category 4</td>
    <td align="center">
      <input name="bdc_cat4" type="text" id="bdc_cat4" size="30" />
    </td>
    <td align="center">
      <input name="bdc4" type="text" id="bdc4" size="30" />
    </td>
    <td> </td>
    <td align="center"><input name="blc_cat4" type="text" id="blc_cat4" size="30" /></td>
    <td align="center"><input name="blc4" type="text" id="blc4" size="30" /></td>
  </tr>
  <tr>
    <td class="right">Business Category 5</td>
    <td align="center">
      <input name="bdc_cat5" type="text" id="bdc_cat5" size="30" />
    </td>
    <td align="center">
      <input name="bdc5" type="text" id="bdc5" size="30" />
    </td>
    <td> </td>
    <td align="center"><input name="blc_cat5" type="text" id="blc_cat5" size="30" /></td>
    <td align="center"><input name="blc5" type="text" id="blc5" size="30" /></td>
  </tr>
  <tr>
    <td class="right">Business Category 6</td>
    <td align="center">
      <input name="bdc_cat6" type="text" id="bdc_cat6" size="30" />
    </td>
    <td align="center">
      <input name="bdc6" type="text" id="bdc6" size="30" />
    </td>
    <td> </td>
    <td align="center"><input name="blc_cat6" type="text" id="blc_cat6" size="30" /></td>
    <td align="center"><input name="blc6" type="text" id="blc6" size="30" /></td>
  </tr>
  <tr>
    <td colspan="6">Business Description (Use Business Description Writing Tool, then Copy and Paste) (900 max. characters)</td>
  </tr>
  <tr>
    <td colspan="6">
      <textarea name="bus_desc" id="bus_desc" cols="150" rows="6"></textarea>
    </td>
  </tr>
  <tr>
    <td colspan="3">Business Services Offered</td>
    <td> </td>
    <td colspan="2">Brands Offered</td>
  </tr>
  <tr>
    <td colspan="3">
      <textarea name="bus_services" id="bus_services" cols="80" rows="5"></textarea>
    </td>
    <td> </td>
    <td colspan="2">
      <textarea name="brands_offered" id="brands_offered" cols="60" rows="5"></textarea>
    </td>
  </tr>
  <tr>
    <td colspan="3"><p>** Key Words ** <span class="style10">(Use words and/phrases the consumer would use) (900 max. characters)</span></p></td>
    <td> </td>
    <td class="right">Language 1</td>
    <td>
      <input type="text" name="language1" id="language1" />
    </td>
  </tr>
  <tr>
    <td colspan="3" rowspan="7"><textarea name="textarea" id="textarea" cols="80" rows="10"></textarea></td>
    <td> </td>
    <td class="right">Language 2</td>
    <td>
      <input type="text" name="language2" id="language2" />
    </td>
  </tr>
  <tr>
    <td> </td>
    <td class="right">Language 3</td>
    <td>
      <input type="text" name="language3" id="language3" />
    </td>
  </tr>
  <tr>
    <td> </td>
    <td class="right">Year Established</td>
    <td>
      <select id="year" name="year">
      <option selected="selected">Select Year</option>
      <option value="2011">2011</option>
      <option value="2010">2010</option>
      <option value="2009">2009</option>
      <option value="2008">2008</option>
      <option value="2007">2007</option>
      <option value="2006">2006</option>
      <option value="2005">2005</option>
      <option value="2004">2004</option>
      <option value="2003">2003</option>
      <option value="2002">2002</option>
      <option value="2001">2001</option>
      <option value="2000">2000</option>
      <option value="1999">1999</option>
      <option value="1998">1998</option>
      <option value="1997">1997</option>
      <option value="1996">1996</option>
      <option value="1995">1995</option>
      <option value="1994">1994</option>
      <option value="1993">1993</option>
      <option value="1992">1992</option>
      <option value="1991">1991</option>
      <option value="1990">1990</option>
      <option value="1989">1989</option>
      <option value="1988">1988</option>
      <option value="1987">1987</option>
      <option value="1986">1986</option>
      <option value="1985">1985</option>
      <option value="1984">1984</option>
      <option value="1983">1983</option>
      <option value="1982">1982</option>
      <option value="1981">1981</option>
      <option value="1980">1980</option>
      <option value="1979">1979</option>
      <option value="1978">1978</option>
      <option value="1977">1977</option>
      <option value="1976">1976</option>
      <option value="1975">1975</option>
      <option value="1974">1974</option>
      <option value="1973">1973</option>
      <option value="1972">1972</option>
      <option value="1971">1971</option>
      <option value="1970">1970</option>
      <option value="1969">1969</option>
      <option value="1968">1968</option>
      <option value="1967">1967</option>
      <option value="1966">1966</option>
      <option value="1965">1965</option>
      <option value="1964">1964</option>
      <option value="1963">1963</option>
      <option value="1962">1962</option>
      <option value="1961">1961</option>
      <option value="1960">1960</option>
      <option value="1959">1959</option>
      <option value="1958">1958</option>
      <option value="1957">1957</option>
      <option value="1956">1956</option>
      <option value="1955">1955</option>
      <option value="1954">1954</option>
      <option value="1953">1953</option>
      <option value="1952">1952</option>
      <option value="1951">1951</option>
      <option value="1950">1950</option>
      <option value="1949">1949</option>
      <option value="1948">1948</option>
      <option value="1947">1947</option>
      <option value="1946">1946</option>
      <option value="1945">1945</option>
      <option value="1944">1944</option>
      <option value="1943">1943</option>
      <option value="1942">1942</option>
      <option value="1941">1941</option>
      <option value="1940">1940</option>
      <option value="1939">1939</option>
      <option value="1938">1938</option>
      <option value="1937">1937</option>
      <option value="1936">1936</option>
      <option value="1935">1935</option>
      <option value="1934">1934</option>
      <option value="1933">1933</option>
      <option value="1932">1932</option>
      <option value="1931">1931</option>
      <option value="1930">1930</option>
      <option value="1929">1929</option>
      <option value="1928">1928</option>
      <option value="1927">1927</option>
      <option value="1926">1926</option>
      <option value="1925">1925</option>
      <option value="1924">1924</option>
      <option value="1923">1923</option>
      <option value="1922">1922</option>
      <option value="1921">1921</option>
      <option value="1920">1920</option>
      <option value="1919">1919</option>
      <option value="1918">1918</option>
      <option value="1917">1917</option>
      <option value="1916">1916</option>
      <option value="1915">1915</option>
      <option value="1914">1914</option>
      <option value="1913">1913</option>
      <option value="1912">1912</option>
      <option value="1911">1911</option>
      <option value="1910">1910</option>
      <option value="1909">1909</option>
      <option value="1908">1908</option>
      <option value="1907">1907</option>
      <option value="1906">1906</option>
      <option value="1905">1905</option>
      <option value="1904">1904</option>
      <option value="1903">1903</option>
      <option value="1902">1902</option>
      <option value="1901">1901</option>
      <option value="1900">1900</option>
      </select>
    </td>
  </tr>
  <tr>
    <td> </td>
    <td class="right"># or Employees</td>
    <td><label>
      <select name="employees" id="employees">
        <option selected="selected">Select # of Employees</option>
        <option value="1-10">1 - 10</option>
        <option value="11-20">11 - 20</option>
        <option value="21-50">21 - 50</option>
        <option value="51-100">51 - 100</option>
        <option value="100+">100+</option>
</select>
    </label></td>
  </tr>
  <tr>
    <td> </td>
    <td>Payment Types Accepted</td>
    <td> </td>
    </tr>
  <tr>
    <td> </td>
    <td class="right">Master Card</td>
    <td><select name="payment_mc" id="payment_mc">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td> </td>
    <td class="right">Visa</td>
    <td><select name="payment_visa" id="payment_visa">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td> </td>
    <td>Open</td>
    <td>Close</td>
    <td> </td>
    <td class="right">Discover</td>
    <td><select name="payment_discover" id="payment_discover">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td class="right">Monday</td>
    <td><select name="monday_open" id="monday_open">
      <option>6 am</option>
      <option>7 am</option>
      <option selected="selected">8 am</option>
      <option>9 am</option>
      <option>10 am</option>
      <option>11 am</option>
      <option>12 pm</option>
    </select></td>
    <td><select name="monday_close" id="monday_close">
      <option>1 pm</option>
      <option>2 pm</option>
      <option>3 pm</option>
      <option>4 pm</option>
      <option selected="selected">5 pm</option>
      <option>6 pm</option>
      <option>7 pm</option>
      <option>8 pm</option>
    </select></td>
    <td> </td>
    <td class="right">American Express</td>
    <td><select name="payment_amex" id="payment_amex">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td class="right">Tuesday</td>
    <td><select name="tuesday_open" id="tuesday_open">
      <option>6 am</option>
      <option>7 am</option>
      <option selected="selected">8 am</option>
      <option>9 am</option>
      <option>10 am</option>
      <option>11 am</option>
      <option>12 pm</option>
    </select></td>
    <td><select name="tuesday_close" id="tuesday_close">
      <option>1 pm</option>
      <option>2 pm</option>
      <option>3 pm</option>
      <option>4 pm</option>
      <option selected="selected">5 pm</option>
      <option>6 pm</option>
      <option>7 pm</option>
      <option>8 pm</option>
    </select></td>
    <td> </td>
    <td class="right">Check</td>
    <td><select name="payment_check" id="payment_check">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td class="right">Wednesday</td>
    <td><select name="wednesday_open" id="wednesday_open">
      <option>6 am</option>
      <option>7 am</option>
      <option selected="selected">8 am</option>
      <option>9 am</option>
      <option>10 am</option>
      <option>11 am</option>
      <option>12 pm</option>
    </select></td>
    <td><select name="wednesday_close" id="wednesday_close">
      <option>1 pm</option>
      <option>2 pm</option>
      <option>3 pm</option>
      <option>4 pm</option>
      <option selected="selected">5 pm</option>
      <option>6 pm</option>
      <option>7 pm</option>
      <option>8 pm</option>
    </select></td>
    <td> </td>
    <td>Discounts Offered</td>
    <td> </td>
    </tr>
  <tr>
    <td class="right">Thursday</td>
    <td><select name="thrusday_open" id="thrusday_open">
      <option>6 am</option>
      <option>7 am</option>
      <option selected="selected">8 am</option>
      <option>9 am</option>
      <option>10 am</option>
      <option>11 am</option>
      <option>12 pm</option>
    </select></td>
    <td><select name="thrusday_close" id="thrusday_close">
      <option>1 pm</option>
      <option>2 pm</option>
      <option>3 pm</option>
      <option>4 pm</option>
      <option selected="selected">5 pm</option>
      <option>6 pm</option>
      <option>7 pm</option>
      <option>8 pm</option>
    </select></td>
    <td> </td>
    <td class="right">Senior Discount</td>
    <td><select name="senior_discount" id="senior_discount">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td class="right">Friday</td>
    <td><select name="friday_open" id="friday_open">
      <option>6 am</option>
      <option>7 am</option>
      <option selected="selected">8 am</option>
      <option>9 am</option>
      <option>10 am</option>
      <option>11 am</option>
      <option>12 pm</option>
    </select></td>
    <td><select name="friday_close" id="friday_close">
      <option>1 pm</option>
      <option>2 pm</option>
      <option>3 pm</option>
      <option>4 pm</option>
      <option selected="selected">5 pm</option>
      <option>6 pm</option>
      <option>7 pm</option>
      <option>8 pm</option>
    </select></td>
    <td> </td>
    <td class="right">Child Discount</td>
    <td><select name="child_discount" id="child_discount">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td class="right">Saturday</td>
    <td><select name="saturday_open" id="saturday_open">
      <option>6 am</option>
      <option>7 am</option>
      <option selected="selected">8 am</option>
      <option>9 am</option>
      <option>10 am</option>
      <option>11 am</option>
      <option>12 pm</option>
      <option>Closed</option>
    </select></td>
    <td><select name="saturday_close" id="saturday_close">
      <option>1 pm</option>
      <option>2 pm</option>
      <option>3 pm</option>
      <option>4 pm</option>
      <option selected="selected">5 pm</option>
      <option>6 pm</option>
      <option>7 pm</option>
      <option>8 pm</option>
      <option>Closes</option>
    </select></td>
    <td> </td>
    <td class="right">AAA Discount</td>
    <td><select name="aaa_discount" id="aaa_discount">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td class="right">Sunday</td>
    <td><select name="sunday_open" id="sunday_open">
      <option>6 am</option>
      <option>7 am</option>
      <option>8 am</option>
      <option>9 am</option>
      <option>10 am</option>
      <option>11 am</option>
      <option>12 pm</option>
      <option selected="selected">Closed</option>
    </select></td>
    <td><select name="sunday_close" id="sunday_close">
      <option>1 pm</option>
      <option>2 pm</option>
      <option>3 pm</option>
      <option>4 pm</option>
      <option>5 pm</option>
      <option>6 pm</option>
      <option>7 pm</option>
      <option>8 pm</option>
      <option selected="selected">Closed</option>
    </select></td>
    <td> </td>
    <td class="right">AARP Discount</td>
    <td><select name="aarp_discount" id="aarp_discount">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td class="right">Open 24 Hours</td>
    <td><select name="allday" id="allday">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    <td> </td>
    <td> </td>
    <td class="right"><p>Military Discount</p></td>
    <td><select name="military_discount" id="military_discount">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td class="right">By Appointment</td>
    <td><select name="appointment" id="appointment">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    <td> </td>
    <td> </td>
    <td class="right">Chamber Member Discount</td>
    <td><select name="chamber_member" id="chamber_member">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td class="right"> </td>
    <td> </td>
    <td> </td>
    <td> </td>
    <td class="right">BBB Member Discount</td>
    <td><select name="bbb_member" id="bbb_member">
      <option>Yes</option>
      <option selected="selected">No</option>
    </select></td>
    </tr>
  <tr>
    <td colspan="6"><table width="898" border="0">
      <tr class="center">
        <td>Sales Agent</td>
        <td>Set-Up Date</td>
        <td>Plan Option</td>
        <td>Merchant Account</td>
        <td>Monthly Price</td>
        <td>Set-Up Fee</td>
      </tr>
      <tr class="center">
        <td>
          <input type="text" name="sales_agent" id="sales_agent" />
        </td>
        <td>
          <input type="text" name="setup_date" id="setup_date" />
        </td>
        <td><select name="plan_option" id="plan_option">
          <option selected="selected">Select Plan</option>
          <option value="Basic">Basic ($199.95)</option>
          <option value="Standard">Standard ($249.95)</option>
          <option value="County">County ($299.95)</option>
          <option value="Metro">Metro ($499.95)</option>
        </select>
        </td>
        <td><label>
          <select name="merchant" id="merchant">
            <option>Yes (-$100.00)</option>
            <option selected="selected">No</option>
          </select>
        </label></td>
        <td><label>
          <input type="text" name="price_mo" id="price_mo" />
        </label></td>
        <td>
          <input type="text" name="setup_fee" id="setup_fee" />
        </td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan="6" align="right"><label>
      <input type="submit" name="Submit" id="Submit" value="Submit" />
    </label></td>
  </tr>
</table></form>

</body>
</html>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.