Formular mit Calculator

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Formular mit Calculator

    Hallo Leute,

    habe im net ein script entdeckt womit man bestellformular erstellen kann bzw. die sortimente mit preis versehen kann und bei der mengenangabe rechnet das system selber.... meine frage ist.. kann mir einer sdagen wie ich das script mit ein formular verknüpfen kann womit man die bestellung auch gleich versendet??

    so schaut das script aus.. nur habe habe ich kein versenden button und name und adressfelder fehlen noch.

    PHP-Code:
    <script language="javascript" type="text/javascript">
      
      function 
    countsum() {
          var 
    gesamtpreis=0;

              for (var 
    i=0;i<document.getElementsByName('anzahl').length;i++) {

    //Wie auch immer du Pro Artikel deine radiobuttons zuweisen möchtest von NULL anfangend für den ersten Artikel -> p_0,2ter Artikel p_1
            
    radiobutton='p_'+i;
                    
                for (var 
    j=0;j<document.getElementsByName(radiobutton).length;j++) {            
                    if (
    document.getElementsByName(radiobutton)[j].checked) {
                     
    gesamtpreis=gesamtpreis+(parseInt(document.getElementsByName('anzahl')[i].value).toFixed(0)*document.getElementsByName(radiobutton)[j].value);
                    }
                }    
            }
         
    document.getElementById('gesPreis').value=gesamtpreis.toFixed(2);
      }
      </
    script
    PHP-Code:
    <form method="post" name="bestellForm" action="">  
    <
    table class="userbody" width="100%" cellspacing="0" cellpadding="2" align="center">    
    <
    tr>      
    <
    td class="content_heads" align="left" colspan="2">Bestellung</td>    
    </
    tr>    
    <
    tr>      
    <
    td class="standard" colspan="2">        
    <
    table width="100%">          
    <
    tr>            
    <
    td class="heads">Produktname:</td>            
    <
    td class="heads">Anzahl:</td>            
    <
    td class="heads">Mietpreis:</td>            
    <
    td class="heads">Kaufpreis:</td>          
    </
    tr>          
    <!-- 
    Produkt Schleife -->            
    <
    tr>  
    <
    td class="standard" align="left">    
    <
    b>Produkt 1</b><br />Testbeschreibung
    </td>  
                    <
    td class="standard" align="center">    
                      <
    input class="anzahl" value="0" type="text" name="anzahl" size="2" onchange="countsum()" />  
                    </
    td>  
                    <
    td class="standard" align="left">    
                      <
    table width="100%">      
                        <
    tr>        
                          <
    td align="left">          
                            <
    input type="radio" class="inputRadioBestell" value="49.00" name="p_0" onclick="countsum()"/>        
                          </
    td>        
                          <
    td align="right">
                            
    49,00 &euro;         
                          </
    td>      
                        </
    tr>    
                      </
    table>  
                    </
    td>  
                    <
    td class="standard" align="left">    
                      <
    table width="100%">      
                        <
    tr>        
                          <
    td align="left">          
                            <
    input type="radio" class="inputRadioBestell" value="1176.00" name="p_0" onclick="countsum()"/>        
                          </
    td>        
                          <
    td align="right">          
                            
    1.176,00 &euro;       
                          </
    td>      
                        </
    tr>    
                      </
    table>  
                    </
    td>  
                  </
    tr>
                  <
    tr>  
                    <
    td class="standard1" align="left">
                      <
    b>Produkt 2</b>
                    </
    td>  
                    <
    td class="standard1" align="center">    
                       <
    input class="anzahl" value="0" type="text" name="anzahl" size="2" onchange="countsum()"/>
                    </
    td>  
                    <
    td class="standard1" align="left">    
                      <
    table width="100%">      
                        <
    tr>        
                          <
    td align="left">          
                            <
    input type="radio" class="inputRadioBestell" value="5.00" name="p_1" onclick="countsum()"/>        
                          </
    td>        
                          <
    td align="right">          
                            
    5,00 &euro;         
                          </
    td>      
                        </
    tr>    
                      </
    table>  
                    </
    td>
                    <
    td class="standard1" align="left">    
                      <
    table width="100%">      
                        <
    tr>        
                          <
    td align="left">          
                            <
    input type="radio" class="inputRadioBestell" value="120.00" name="p_1" onclick="countsum()"/>        
                          </
    td>        
                          <
    td align="right">          
                            
    120,00 &euro;         
                          </
    td>      
                        </
    tr>    
                      </
    table>  
                    </
    td>  
                  </
    tr>
                  <
    tr>  
                    <
    td class="standard" align="left">    
                      <
    b>Produkt 3</b>  
                    </
    td>  
                    <
    td class="standard" align="center">    
                      <
    input class="anzahl" value="0" type="text" name="anzahl" size="2" onchange="countsum()" />  
                    </
    td>  
                    <
    td class="standard" align="left">    
                      <
    table width="100%">      
                        <
    tr>        
                          <
    td align="left">          
                            <
    input type="radio" class="inputRadioBestell" value="5.00" name="p_2" onclick="countsum()"/>        
                          </
    td>        
                          <
    td align="right">          
                            
    5,00 &euro;         
                          </
    td>      
                        </
    tr>    
                      </
    table>  
                    </
    td>  
                    <
    td class="standard" align="left">    
                      <
    table width="100%">      
                        <
    tr>        
                          <
    td align="left">          
                            <
    input type="radio" class="inputRadioBestell" value="120.00" name="p_2" onclick="countsum()"/>        
                          </
    td>        
                          <
    td align="right">          
                            
    120,00 &euro;         
                          </
    td>      
                        </
    tr>    
                      </
    table>  
                    </
    td>  
                  </
    tr>     
                  <!-- 
    Produkt Schleife Ende -->          
                  <
    tr>          
                    <
    td colspan="4" align="right">
                      
    Gesamtpreis: <input type="text" size="8" id="gesPreis" readonly value="0" style="border: 0px;" /> Euro           
                    
    </td>
                  </
    tr>        
                </
    table>      
              </
    td>       </tr>  
    </
    table>
    </
    form


    würde mich auf eure hilfe freuen.

    Gruss

    Bebetto

  • #2
    Lesen: http://www.php-resource.de/forum/sho...threadid=50454 => achte auf den Scrollbalken

    Der Thread klingt nach "Mach-Mir-Mal-Frage", daher verschieb nach Projekthilfe.

    Kommentar

    Lädt...
    X