* * PHP, why does the php code embedded in html report an error on lines 15, 16 and 17? **

report an error as shown in the figure:

localhostHtml
htmlorderform -1,processorder1.php
orderform-1 Eprocessorder1.phpDD:XAMPPhtdocs

:

,:

< / H2 >

I looked at it and it seemed that the download item had been downloaded to disk C.

the following code is the code named processorder1.php (written and stored in the D:XAMPPhtdocs directory of d disk):

<html>
<head>
  <title>Bob"s Auto Parts - Order Results</title>
</head>
<body>
<h1>Bob"s Auto Parts</h1>
<h2>Order Results</h2>
<?php
  echo"

Order Processed.

"; echo"

Order processed at"; echo date("H:i,jS F Y"); echo"

"; $tireqty = $_POST["tireqty"]; $oilqty = $_POST["oilqty"]; $sparksqty = $_POST["sparksqty"]; echo "

Your Order is as follows:

"; echo $tireqty."tires<br/>"; echo $oilqty."bottles<br/>"; echo $sparksqty."spark plugs<br/>"; ?> </body> </html>
< hr > The code of

orderform-1.html is as follows (written and saved in the project folder of disk E):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
</style>
</head>
<body>
<form action="processorder1.php" method="post">
<table border="0">
<tr bgcolor="-sharpcccccc">
<td width="150">Item</td>
<td width="15">Quantity</td>
<tr>
  <td>Tires</td>
  <td align="center"><input type="text" name="tireqty" size="3"
    maxlength="3"/></td>
</tr>
<tr>
  <td>Oil</td>
  <td align="center"><input type="text" name="oilqty" size="3"
    maxlength="3"/></td>
</tr>
<tr>
  <td>Sparks</td>
  <td align="center"><input type="text" name="sparksqty" size="3"
    maxlength="3"/></td>
</tr>
<tr>
   <td colspan="2" align="center"><input type="submit" 
    value="Submit Order"/></td>
</tr>
</table>
</form>
</body>
</html>

Php
Jun.13,2022

undefined index, that is, $_ POST does not have these key values when it is not committed.
you can determine whether it is submitted by post before receiving and processing.

<html>
<head>
  <title>Bob's Auto Parts - Order Results</title>
</head>
<body>
<h1>Bob's Auto Parts</h1>
<h2>Order Results</h2>
<?php
  echo'

Order Processed.

'; echo'

Order processed at'; echo date('H:i,jS F Y'); echo'

'; $tireqty = $oilqty = $sparksqty = ''; if(isset($_POST["submit"])) { $tireqty = isset($_POST['tireqty']) ? $_POST['tireqty'] : ''; $oilqty = isset($_POST['oilqty']) ? $_POST['oilqty'] : ''; $sparksqty = isset($_POST['sparksqty']) ? $_POST['sparksqty'] : ''; } echo '

Your Order is as follows:

'; echo $tireqty.'tires<br/>'; echo $oilqty.'bottles<br/>'; echo $sparksqty.'spark plugs<br/>'; ?> </body>

echo'

Your Order is as follows:

;
ending single quotation marks


check grammar problems first. A good IDE will help you improve the efficiency of your code


.

it turns out that you want to change the processorder1.php in orderform-1.html to the absolute path, that is, action= "http://localhost/processorder1.php
or put orderform-1 on http://localhost/orderform-1....

.

then run the order submission program and processorder1.php runs automatically without error!

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b30792-2bd0e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b30792-2bd0e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?