Andrew Steven
Andrew Steven

Reputation: 9

PHP tables causing issues

ive been finishing a school project which needs to get a response from a server so ive written some php code. Ive got everything to align up with tables but when I implement it, I get a Giant gap in code. Has anyone seen this before, I know its the tabs causing this but idk why they keep messing it up, ive tried to move them, but everything in them and more with no luck. below is the outcome of this code,

thank you for your help. Code’s outcome

<?php

  // create short variable names
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$address = $_POST['address'];
$city = $_POST['city'];
$zip = $_POST['zip'];
$state = $_POST['state'];
$outdate = $_POST['outdate'];
$indate = $_POST['indate'];
$numberofpeople = $_POST['numberofpeople'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$cardtype = $_POST['cardtype'];
$cardnum = $_POST['cardnum'];
$specialrequests = $_POST['specialrequests'];

  $DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
?>
<html>
<body>
<?php
//displays what the user put in the form by using the vairables
 echo "<table>";
 echo '<h1>Thank you '.$fname.' '.$lname.' for your Reservation</h1><br>';
echo 'The following is the infomation you entered:<br></tr>';
echo "<tr><td>Number & Street</td><td>$address</td><br/</tr>"; 
echo "<tr><td>City</td><td>$city</td><br></tr>"; 
echo "<tr><td>ZipCode</td><td>$zip</td><br></tr>"; 
echo "<tr><td>State</td><td>$state</td><br></tr>"; 
echo "<tr><td>Check-In Date</td><td>$indate</td><br></tr>"; 
echo "<tr><td>Check-out Date</td><td>$outdate</td><br></tr>"; 
echo "<tr><td>Number of People</td><td>$numberofpeople</td><br></tr>"; 
echo "<tr><td>Phone</td><td>$phone</td><br></tr>"; 
echo "<tr><td>Email</td><td>$Email</td><br></tr>"; 
echo "<tr><td>Card-Type</td><td>$cardtype</td><br></tr>"; 
echo "<tr><td>Card-Number</td><td>$cardnum</td><br></tr>"; 
echo "<tr><td>Special Requests</td><td>$specialrequests</td><br></tr>"; 
echo  "</table>";
?>
</body>
</html>

Upvotes: 1

Views: 49

Answers (1)

Sahan Dissanayaka
Sahan Dissanayaka

Reputation: 621

<?php

// create short variable names
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$address = $_POST['address'];
$city = $_POST['city'];
$zip = $_POST['zip'];
$state = $_POST['state'];
$outdate = $_POST['outdate'];
$indate = $_POST['indate'];
$numberofpeople = $_POST['numberofpeople'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$cardtype = $_POST['cardtype'];
$cardnum = $_POST['cardnum'];
$specialrequests = $_POST['specialrequests'];

$DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
?>
<html>
<body>

<h1>Thank you <?php echo $fname." "; ?><?php echo $lname; ?> for your Reservation</h1><br>
<h2>The following is the infomation you entered:</h2><br>
<table>
<tr>
    <td>Number & Street</td>
    <td><?php echo $address; ?></td>
</tr>
... complete other in this fashion
</table>
</body>
</html>

Inside the table, you put a h1 tag

some tags were not hadn't an enclosing tag at some lines.

Make sure that your code has lots of vulnerabilities. please learn some good programming techniques to implement your code

enter image description here Complete the other tables rows.

Upvotes: 4

Related Questions