• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 372
  • Last Modified:

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

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
Imageman
Asked:
Imageman
  • 4
  • 4
  • 2
1 Solution
 
us111Commented:
what are the point you know or don't know?
what you are asking is a lot of work.
0
 
ImagemanAuthor Commented:
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
 
us111Commented:
>>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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
charlierokerCommented:
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
 
charlierokerCommented:
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
 
ImagemanAuthor Commented:
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
 
ImagemanAuthor Commented:
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
 
charlierokerCommented:
$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
 
ImagemanAuthor Commented:
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
 
charlierokerCommented:
windows
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now