PDA

View Full Version : مشکل این کد کجاست اجرا میشه فقط چند تا خط دیگه هم با خودش چاپ میکنه ؟



xman_dj
سه شنبه 31 شهریور 1388, 10:02 صبح
میشه بگین ایراد این کد کجاست ؟
اینم + جمع کل اعداد نشون میده
ایراد:


PHP Notice: Use of undefined constant t2 - assumed 't2' in C:\Inetpub\wwwroot\phpsum.php on line 12 PHP Notice: Use of undefined constant t3 - assumed 't3' in C:\Inetpub\wwwroot\phpsum.php on line 12


کد صفحه ی من



<body bgcolor="#000066">
<h2><font color="#FFFFFF"> hi this is book_price code</font></h2>
<?php
$sum = $_POST['t1'] + $_POST[t2] + $_POST[t3];
echo '<b> total sum :'. $sum.'<br>';
?>
<form action="1.php" method="post" >
<table width="263" border="1">
<caption>
<font color="#FFFFFF"><b> عملیات</font>
</caption>
<tr>
<th width="103" scope="col" bgcolor="#99FF33">لیست کتاب ها</th>
<th width="144" scope="col" bgcolor="#99FF33">تعداد</th>
</tr>
<tr>
<td bgcolor="#FF33CC">c++</td>
<td><input name="t1" type="text" value="0" />;</td>
</tr>
<tr>
<td bgcolor="#FF33CC">java</td>
<td><input name="t2" type="text" value="0" />;</td>
</tr>
<tr>
<td bgcolor="#FF33CC">vb</td>
<td><input name="t3" type="text" value="0" />;</td>
</tr>
<tr>
<td bgcolor="#FF33CC">send</td>
<td align="center"><input name="bot1" type="submit" value="ارسال اطلاعات" />;</td>
</tr>
</table>
</form>

</body>
</html>

Yousha
سه شنبه 31 شهریور 1388, 12:24 عصر
سلام،
مشکل شما در t2 t3 هستش. باید اینهارو در کوتیشن ' قرار بدید.


$sum = $_POST['t1'] + $_POST['t2'] + $_POST['t3'];