?
Solved

Auto fill in form using populated menus with php and mysql!

Posted on 2003-03-03
10
Medium Priority
?
369 Views
Last Modified: 2013-12-12
I just want to say first off that I am a new bie to php and mysql.

Here is my question: A breakdown of what I need to be able to do.

1: I have a php form, with a populated menu, that reads info from a table.

2: You pull the menu down, pick your Product lets says. And the product is then filled into the field below. This adds the price of the product.

3: Next to the field that as the new product select, there is a field that you put in a #. Example How many products? 1, or 2

5: Next with the amount put in, You have another menu that selects lets say the vender. and any other info into other fields.

5: With every thing selected and filled into the fields. I need to be able to create a Total amount, with options of a % mark up, add sales taxes, etc with the total amout due.

6: With all the info filled in, their is a next button that, when pressed takes all the info and places them into a nicly created invoice page. Once there the person has an option to send the invoice to a clients e-mail, they can select the clients e-mail from a drop down menu, and then sent a cc to themselfs.

7: All the info in the e-mail is sent  in HTML formate, and also has the choose to save a copy as a PDF formate and then download it. Then they just print it out. All the info is also added to a table as well, to be edited or delected.
0
Comment
Question by:Imageman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
10 Comments
 
LVL 8

Expert Comment

by:us111
ID: 8058570
what are the point you know or don't know?
what you are asking is a lot of work.
0
 

Author Comment

by:Imageman
ID: 8058856
Okay, I explained it in that fashion, so people understand what my
long term goal is, when every thing is done. So I will now just put what I am having problems with.

Creating a populated menu, that reads from a table, that sits in a database.

All I need to be able to figure out is, is when someone pulls down the menu that holds info such as Products. They choose the Product and right below the product is a blank field. Which will be filled once they have selected the Product that they want.

After this, I just need to be able have the ability to add how many products they would like and then have it come up with a total.

The rest I will figure out or post as needed.

Thats all I need to be able to do at this point.

Thanks InAdvaced
Imageman

P.S us111, what did you mean at the beginning of your statement?
what are the point you know or don't know?  // What do you mean?
0
 
LVL 8

Expert Comment

by:us111
ID: 8058903
>>what are the point you know or don't know?
anyway. I meant which parts of your question you know how to figure out.

ok now I understand but time to leave...
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Accepted Solution

by:
charlieroker earned 300 total points
ID: 8063799
I'm a newbie as well, but I have manage to get the code below to enable you to type in the text box with an autocomplete function.  This will thne enable you to find more accurately the answer you want in a drop down list of customers.  My next task is too make this populate a table with the rest of the info.

Hope this helps.


<?php require_once('Connections/turner.php'); ?>
<?php
mysql_select_db($database_turner, $turner);
$query_RSturner1 = "SELECT * FROM customers ORDER BY CompanyName ASC";
$RSturner1 = mysql_query($query_RSturner1, $turner) or die(mysql_error());
$row_RSturner1 = mysql_fetch_assoc($RSturner1);
$totalRows_RSturner1 = mysql_num_rows($RSturner1);
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE=javascript>
<!--
var to_find = "";              // Variable that acts as keyboard buffer
var timeoutID = "";           // Process id for timer (used when stopping
                            // the timeout)
timeoutInterval = 400;        // Milliseconds. Shorten to cause keyboard
                            // buffer to be cleared faster
var timeoutCtr = 0;           // Initialization of timer count down
var timeoutCtrLimit = 3 ;     // Number of times to allow timer to count
                            // down
function idle(){
 timeoutCtr += 1
 if(timeoutCtr > timeoutCtrLimit){
    to_find="";
    timeoutCtr = 0;
    window.clearInterval(timeoutID);
 }
}
function findMatch(selectBox, txtFind, objEvent, forcematch) {
if (txtFind == '' || objEvent.keyCode == 8) {
     return;
}
// Key press buffer
// Stop Timer
window.clearInterval(timeoutID)
var c = String.fromCharCode(objEvent.keyCode);
c = c.toLowerCase();
to_find += c;
 // Reset timer
 timeoutID = window.setInterval("idle()", timeoutInterval);  
allWords = selectBox.options;
var posLow = 0;
var posHigh = selectBox.options.length;
var foundIt = false;
var st2 = new String(to_find);
s2 = st2.toLowerCase();
while (posLow <= posHigh) {
     posMid = Math.floor((posLow + posHigh) / 2);
     s = selectBox.options[posMid].text;
     st = new String(s);
     s = st.toLowerCase();
     if (s.indexOf(s2) == 0) {
          foundIt = true;
          selectBox.selectedIndex = posMid;
             // Highlight the remaining text
             
             var typed_string = new String(s2);
             var total_string = new String(s);
             var t = total_string.length - (total_string.length - typed_string.length);
             end_string = total_string.substr(t, total_string.length);
             txtFind.value = s;
             if (end_string != "") {
                  var range = txtFind.createTextRange();
                  range.findText(end_string)
                 range.select();
             }
             
          break;
     } else {
          if (s2 < s) {
               posHigh = posMid - 1;
          } else {
               posLow = posMid + 1;
          }
     }
}
if (!foundIt) {
     selectBox.selectedIndex = 0;
}

}
//-->
</SCRIPT>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<style type="text/css">
<!--
.text {
 font-family: Arial, Helvetica, sans-serif;
 font-size: 10px;
 color: #444444;
 background-color: #FFEAEA;
}
-->
</style>
</head>
<body>
<form name="form1" method="post" action="">

<input name="text"  type="theselect"  onKeyUp="findMatch(this.form.theselect, this, event);">

<div id="Layer1" style="position:absolute; width:200px; height:115px; z-index:1; visibility: visible; left: 177px; top: 18px;">
  <select name="theselect" class="text" id="select"  >
    <?php
do {  
?>
    <option value="<?php echo $row_RSturner1['CompanyName']?>"><?php echo $row_RSturner1['CompanyName']?></option>
    <?php
} while ($row_RSturner1 = mysql_fetch_assoc($RSturner1));
  $rows = mysql_num_rows($RSturner1);
  if($rows > 0) {
      mysql_data_seek($RSturner1, 0);
   $row_RSturner1 = mysql_fetch_assoc($RSturner1);
  }

?>
  </select>
</div>
<br>
<br>
<font size="2" face="Courier New, Courier, mono">tlll</font>
</form>

</body>
</html>
<?php
mysql_free_result($RSturner1);
?>
0
 
LVL 1

Expert Comment

by:charlieroker
ID: 8063803
I'm a newbie as well, but I have manage to get the code below to enable you to type in the text box with an autocomplete function.  This will thne enable you to find more accurately the answer you want in a drop down list of customers.  My next task is too make this populate a table with the rest of the info.

Hope this helps.


<?php require_once('Connections/turner.php'); ?>
<?php
mysql_select_db($database_turner, $turner);
$query_RSturner1 = "SELECT * FROM customers ORDER BY CompanyName ASC";
$RSturner1 = mysql_query($query_RSturner1, $turner) or die(mysql_error());
$row_RSturner1 = mysql_fetch_assoc($RSturner1);
$totalRows_RSturner1 = mysql_num_rows($RSturner1);
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE=javascript>
<!--
var to_find = "";              // Variable that acts as keyboard buffer
var timeoutID = "";           // Process id for timer (used when stopping
                            // the timeout)
timeoutInterval = 400;        // Milliseconds. Shorten to cause keyboard
                            // buffer to be cleared faster
var timeoutCtr = 0;           // Initialization of timer count down
var timeoutCtrLimit = 3 ;     // Number of times to allow timer to count
                            // down
function idle(){
 timeoutCtr += 1
 if(timeoutCtr > timeoutCtrLimit){
    to_find="";
    timeoutCtr = 0;
    window.clearInterval(timeoutID);
 }
}
function findMatch(selectBox, txtFind, objEvent, forcematch) {
if (txtFind == '' || objEvent.keyCode == 8) {
     return;
}
// Key press buffer
// Stop Timer
window.clearInterval(timeoutID)
var c = String.fromCharCode(objEvent.keyCode);
c = c.toLowerCase();
to_find += c;
 // Reset timer
 timeoutID = window.setInterval("idle()", timeoutInterval);  
allWords = selectBox.options;
var posLow = 0;
var posHigh = selectBox.options.length;
var foundIt = false;
var st2 = new String(to_find);
s2 = st2.toLowerCase();
while (posLow <= posHigh) {
     posMid = Math.floor((posLow + posHigh) / 2);
     s = selectBox.options[posMid].text;
     st = new String(s);
     s = st.toLowerCase();
     if (s.indexOf(s2) == 0) {
          foundIt = true;
          selectBox.selectedIndex = posMid;
             // Highlight the remaining text
             
             var typed_string = new String(s2);
             var total_string = new String(s);
             var t = total_string.length - (total_string.length - typed_string.length);
             end_string = total_string.substr(t, total_string.length);
             txtFind.value = s;
             if (end_string != "") {
                  var range = txtFind.createTextRange();
                  range.findText(end_string)
                 range.select();
             }
             
          break;
     } else {
          if (s2 < s) {
               posHigh = posMid - 1;
          } else {
               posLow = posMid + 1;
          }
     }
}
if (!foundIt) {
     selectBox.selectedIndex = 0;
}

}
//-->
</SCRIPT>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<style type="text/css">
<!--
.text {
 font-family: Arial, Helvetica, sans-serif;
 font-size: 10px;
 color: #444444;
 background-color: #FFEAEA;
}
-->
</style>
</head>
<body>
<form name="form1" method="post" action="">

<input name="text"  type="theselect"  onKeyUp="findMatch(this.form.theselect, this, event);">

<div id="Layer1" style="position:absolute; width:200px; height:115px; z-index:1; visibility: visible; left: 177px; top: 18px;">
  <select name="theselect" class="text" id="select"  >
    <?php
do {  
?>
    <option value="<?php echo $row_RSturner1['CompanyName']?>"><?php echo $row_RSturner1['CompanyName']?></option>
    <?php
} while ($row_RSturner1 = mysql_fetch_assoc($RSturner1));
  $rows = mysql_num_rows($RSturner1);
  if($rows > 0) {
      mysql_data_seek($RSturner1, 0);
   $row_RSturner1 = mysql_fetch_assoc($RSturner1);
  }

?>
  </select>
</div>
<br>
<br>
<font size="2" face="Courier New, Courier, mono">tlll</font>
</form>

</body>
</html>
<?php
mysql_free_result($RSturner1);
?>
0
 

Author Comment

by:Imageman
ID: 8064524
Thanks for the script. I am working with it and trying to figure out, some of the javascript errors, Along with the Parse error.

I can see that it is looking for $RSturner1. when I change that custom var, It still can't seem to get by the same var, So I changed the var back.

Can you post the connection script. I want to be able to see what  you have done. Do you have a place I can go to see what you have done? My E-mail address is located at http://www.northsidemedia.com

Thanks InAdvanced
Imageman
0
 

Author Comment

by:Imageman
ID: 8064647
Thanks for the script. I am working with it and trying to figure out, some of the javascript errors, Along with the Parse error.

I can see that it is looking for $RSturner1. when I change that custom var, It still can't seem to get by the same var, So I changed the var back.

Can you post the connection script. I want to be able to see what  you have done. Do you have a place I can go to see what you have done? My E-mail address is located at http://www.northsidemedia.com

Thanks InAdvanced
Imageman
0
 
LVL 1

Expert Comment

by:charlieroker
ID: 8064752
$RSTurner1 is the name of the connection to my MYSQL database.  My script is on an intranet.  So I wouldn't be able to help too much.  As for the connection script if you just change my script to match you connection.  I have built it in Dreamweaver.  I would add the connection script for you and the DB is called turner
0
 

Author Comment

by:Imageman
ID: 8064925
Thanks dude, I will check it out. When you say your working on Dreamweaver. Let me ask you a question, Windows or Mac. If Mac, I might need your help.


Thanks InAdvanced
Imageman
0
 
LVL 1

Expert Comment

by:charlieroker
ID: 8064987
windows
0

Featured Post

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question