PHP Forum

PHP Forum (http://www.selfphp.de/forum/index.php)
-   PHP Grundlagen (http://www.selfphp.de/forum/forumdisplay.php?f=12)
-   -   werte addieren (http://www.selfphp.de/forum/showthread.php?t=6637)

Jonny 13.01.2004 16:15:30

werte addieren
 
hallo

wie kann ich ein total der beiden werte anzeigen. sicher ganz einfach, aber php-newbie, und irgendwie check ich nicht wie die werte zu benennen sind..... ;-))

vieeelen dank!

<html>

<head>
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
<title>test</title>
</head>

<body bgcolor="#ffffff">
<p></p>
<form action="index.php" method="post" target="_self">
<table width="339" border="1" cellspacing="2" cellpadding="0">
<tr>
<td>Menge1:</td>
<td><input type="Text" name="zahl1" value="<?php echo $_POST['zahl1'] ?>" size="10"></td>
<td>Preis: 7.50</td>
<td><?php echo number_format($_POST['zahl1'] * 7.50,2,".",","); ?></td>
</tr>
<tr>
<td>Menge2:</td>
<td><input type="Text" name="zahl2" value="<?php echo $_POST['zahl2'] ?>" size="10"></td>
<td>Preis: 7.50</td>
<td><?php echo number_format($_POST['zahl2'] * 7.50,2,".",","); ?></td>
</tr>
<tr>
<td></td>
<td></td>
<td>Total</td>
<td></td>
</tr>
</table>
<p><br>
<br>
<br>
<input type="submit" name="berechnen" value="Rechnen"></p>
</form>
<p></p>
</body>

</html>

feuervogel 13.01.2004 16:28:49

hö? also bei mir aufm server gehts einwandfrei...schau mal da:

keine eigenwerbung

feuervogel 13.01.2004 16:33:02

achso, total... *überlesenhat*

schreibs so:


Code:

<html>

<head>
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
<title>test</title>
</head>

<body bgcolor="#ffffff">
<p></p>
<form action="format.php" method="post" target="_self">
<table width="339" border="1" cellspacing="2" cellpadding="0">
<tr>
<td>Menge1:</td>
<td><input type="Text" name="zahl1" value="<?php echo $_POST['zahl1'] ?>" size="10"></td>
<td>Preis: 7.50</td>
<td><?php echo number_format($_POST['zahl1'] * 7.50,2,".",","); ?></td>
</tr>
<tr>
<td>Menge2:</td>
<td><input type="Text" name="zahl2" value="<?php echo $_POST['zahl2'] ?>" size="10"></td>
<td>Preis: 7.50</td>
 <td><?php echo number_format($_POST['zahl2'] * 7.50,2,".",","); ?></td>
</tr>
<tr>
<td></td>
<td></td>
<td>Total</td>
<td><?php echo $_POST[ 'zahl1' ] * 7.50 + $_POST[ 'zahl2' ] * 7.50; ?></td>
</tr>
</table>
<p><br>
<br>
<br>
<input type="submit" name="berechnen" value="Rechnen"></p>
</form>
<p></p>
</body>

</html>

so schwer wars doch nicht, oder?

Jonny 13.01.2004 16:41:32

aaahhhh, danke, das geht ja schnell hier!!

nein nicht schwer, hab nur kein plan von php (im moment noch) und 2548 andere sachen laufen.

thx


Alle Zeitangaben in WEZ +2. Es ist jetzt 11:56:31 Uhr.

Powered by vBulletin® Version 3.8.3 (Deutsch)
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.