Jump to content
Sign in to follow this  
mahbub

Variable Strings

Recommended Posts

When I run this code, It's showing erroorrr... wts wrong with this  1 ----------------------------------------------------------------------------- <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title> Q 1 </title>
</head>

<body>

    <h1> Radio Frequency Interference at the ATCA </h1>

    <p> The radio spectrum that is most often used by radio astronomers to observe the universe (frequencies of a few GHz) is also widely used by modern technology, leading to interference. Radio telescopes are very sensitive detectors of radio waves, so man-made devices that emit radio waves are easily seen. Although these devices are far less powerful than the jets of plasma emanating from a supermassive black hole in a distant galaxy, they are far, far closer. </p>

    <p> Since most interference is man-made, it follows the human population. Thus, remote areas might be expected to have less interference. The <q><strong> Australia Telescope Compact Array </strong></q> (ATCA)  is 20km away from Narrabri, in a shire of only 14000 people. Nevertheless, radio frequency interference is a major problem.</p>

    <h3> Sources of RFI at <a href="http://www.narrabri.atnf.csiro.au/"> ATCA </a>: </h3>
    
    <ul>
        <li>mobile phones</li>    
        <li>wi-fi</li>
        <li>microwave ovens</li>
        <li>communications satellites</li>    
        <li>navigation satellites</li>
        <li>radar</li>
    </ul>
    <p> A full list of the known sources of man-made interference at the telescope covers all these and more. </p>

</body>
</html>

 2 ---------------------------------------------------------------------------
<!DOCTYPE html>
<html lang="en">
<head>
    
    <meta charset="UTF-8">
    <title> Question 1 </title>
    <style type = "text/css">
        
        body{
            color: white;        
            background-color: blue;
            border-color: red;
            border-style: solid;}    
        h1{
        font-size: 3em;}
        h3{
        background-color: black;}
        ul{
        font-size: 1.2em;
        }
        a{
        color:white;}    
    </style>
</head>
    
<body>
    <h1> Radio Frequency Interference at the ATCA </h1>

    <p> The radio spectrum that is most often used by radio astronomers to observe the universe (frequencies of a few GHz) is also widely used by modern technology, leading to interference. Radio telescopes are very sensitive detectors of radio waves, so man-made devices that emit radio waves are easily seen. Although these devices are far less powerful than the jets of plasma emanating from a supermassive black hole in a distant galaxy, they are far, far closer. </p>
    <p> Since most interference is man-made, it follows the human population. Thus, remote areas might be expected to have less interference. The <q><strong> Australia Telescope Compact Array </strong></q> (ATCA)  is 20km away from Narrabri, in a shire of only 14000 people. Nevertheless, radio frequency interference is a major problem.</p>

    <h3> Sources of RFI at <a href="http://www.narrabri.atnf.csiro.au/"> ATCA </a>: </h3>
    <ul>
        <li>mobile phones</li>    
        <li>wi-fi</li>
        <li>microwave ovens</li>
        <li>communications satellites</li>    
        <li>navigation satellites</li>
        <li>radar</li>
    </ul>
    <p> A full list of the known sources of man-made interference at the telescope covers all these and more. </p>
</body>
</html>


4 --------------------------------------------
<?php
$dbConn = new mysqli("location", "username", "password", "elecDatabaseName");
if($dbConn->connect_error)
{
die("Failed to connect to database " . $dbConn->connect_error);
}
?>

<?php

if (isset($_POST["submit"])){

$val=$_POST["customerNum"];
$sn=$_POST["shipped"];


if ($sn=="Y"){
$sql = "SELECT orderID, orderDate,shippingDate,customer.customerID,firstName,lastName,postcode
FROM customer
INNER JOIN purchase ON customer.customerID=purchase.customerID
WHERE customer.customerID='$val' AND  purchase.shipped='$sn'
ORDER BY orderDate ASC";
$results =  $dbConn->query($sql)or
die ('Problem with query: ' . $dbConn->error);

$count = mysqli_num_rows($results);
}

elseif($sn=="N"){
$sql = "SELECT orderID, orderDate,shippingDate,customer.customerID,firstName,lastName,postcode
FROM customer
INNER JOIN purchase ON customer.customerID=purchase.customerID
WHERE customer.customerID='$val' AND  purchase.shipped='$sn'
ORDER BY orderDate ASC";
$results =  $dbConn->query($sql)or
die ('Problem with query: ' . $dbConn->error);

$count = mysqli_num_rows($results);
}}
?>

<?php if ($count>0){ ?>

<table>
<tr>

<th>orderID</th>
<th>orderDate</th>
<th>shippingDate</th>
<th>customerID</th>
<th>firstName</th>
<th>lastName</th>
<th>postcode</th>
</tr>
       <?php
while ($row = $results->fetch_assoc()) { ?>
<tr>

<td><?php echo $row["orderID"]?></td>
<td><?php echo $row["orderDate"]?></td>
<td><?php echo $row["shippingDate"]?></td>
<td><?php echo $row["customerID"]?></td>
<td><?php echo $row["firstName"]?></td>
<td><?php echo $row["lastName"]?></td>
<td><?php echo $row["postcode"]?></td>

</tr>

<?php }

$dbConn->close();
?>

</table>
<?php } else{
echo "Nothing Found";

} ?>

</body>
</html>              

-------------------------

1..........................................................

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>WAASAAS Frequent Flier Survey - Speak your Brains!</title>
  <link href="styles.css" rel="stylesheet">

</head>

<body>
  <h1> WAASAAS Frequent Flier Survey</h1>
  <form id="Q3form" method="post" action="survey.php" >

        <p>
          <label for="first">First Name:</label>
          <input type="text" id="first" name="first">
          <label for="last">Family Name:</label>
          <input type="text" id="last" name="last">
        </p>
        <p>
          <label for="ffno">WAASAAS Frequent Flier Number:</label>
          <input type="text" id="ffno" name="ffno" placeholder="">
        </p>
   
    <br>

    <br>
     <label for="meal">Preferred meal:</label>
        <select id="meal" name="meal" size="1">
          <option value=""> -- </option>
          <option value="std"> Standard </option>
          <option value="veg"> Vegetarian </option>
          <option value="vegan"> Vegan </option>
          <option value="gf"> Gluten-free </option>
          <option value="fruit"> Fruitarian </option>
          <option value="meat"> Meat-lover's - no vegetables </option>
          <option value="vegemite"> Vegemite sandwich </option>
        </select>
        <br>

        <p>What do you like to do during flights?<br>
          <input type="checkbox" id="chbx1" name="inflight" value="snore"><label for="chbx1">Snore loudly</label><br>
          <input type="checkbox" id="chbx2" name="inflight" value="eat"><label for="chbx2">Eat messily</label><br>
          <input type="checkbox" id="chbx3" name="inflight" value="talk"><label for="chbx3">Talk to the person next to you</label><br>
          <input type="checkbox" id="chbx4" name="inflight" value="whinge"><label for="chbx4">Complain to the cabin crew</label><br>
          <input type="checkbox" id="chbx5" name="inflight" value="sleep"><label for="chbx5">Sleep in the aisle</label><br>
        </p>      
    <br>

        <input type="submit" value="Submit">
        <input type="reset" value="Reset">
  </form>
</body>
</html>

2 ...................................................

body {
    margin:0;
    padding:0;
    font-family: Arial;
    font-size:1em;
    font-color:navy;
    background-color:white;
    color:#000000;
}
h1{
font-size:90px;}
form {
    margin:20px;
    background-color:lightblue;
    padding:0.5cm;
}

input[type="text"], select {
    width:250px;
    padding:3px;
    font-size:1em;
}

input[type="submit"] {
    padding:3px;
    font-size:1em;
}

label {
    display:inline-block;
    width:150px;
}

table {
    border-collapse: collapse;
    margin:10px;
}

table, th, td {
    border: black solid 1px;
    padding:3px;
    text-align: center;
}

3 -----------------------------------------


<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>WAASAAS Frequent Flier Survey - Speak your Brains!</title>
  <link href="styles.css" rel="stylesheet">
<style type="text/css">
          table, td { border: 1px solid gray; padding:3px; }
          input[type="text"] { border: 1px solid black; }
      .error { color:red; }
    </style>
</head>

<body>

<?php
if ( isset($_POST["submit"])) {

$x=$_POST["first"];
$y=$_POST["last"];
$z=$_POST["ffno"];

 
 $Msg1= '<span class="error">You must enter First Name.</span>';
  $Msg2= '<span class="error">You must enter Family Name.</span>';
  $Msg3= '<span class="error">You must enter  WAASAAS Frequent Flier Number:.</span>';
  $Msg4= '<span class="error">You must choose a preferred meal.</span>';
  $Msg5= '<span class="error">You must choose at least one option </span>';
  $Msg= '<span class="error">You must enter a 8 digit number </span>';
}

?>
  <h1> WAASAAS Frequent Flier Survey</h1>
  <form id="Q3form" method="post" action="question3.php" >

        <p>
          <label for="first">First Name:</label>
          <input type="text" id="first" name="first" value="<?php if ( isset($_POST["submit"])) echo htmlspecialchars($x); ?>"   ><?php if ( isset($_POST["submit"]) && empty($_POST["first"]))  echo $Msg1; ?>   
          <label for="last">Family Name:</label>
          <input type="text" id="last" name="last" value="<?php if ( isset($_POST["submit"])) echo htmlspecialchars($y); ?>" ><?php if ( isset($_POST["submit"]) && empty($_POST["last"]))  echo $Msg2; ?>   
        </p>
        <p>
          <label for="ffno">WAASAAS Frequent Flier Number:</label>
          <input type="text" id="ffno" name="ffno"value="<?php if ( isset($_POST["submit"])) echo htmlspecialchars($z); ?>"  placeholder=""><?php if ( isset($_POST["submit"]) && empty($_POST["ffno"]))  echo $Msg3; elseif (isset($_POST["submit"]) && !preg_match('/^[0-9]{8}$/', $z)) echo $Msg; ?>   
        </p>
   
    <br>

    <br>
    
    <?php if ( isset($_POST["submit"]) && empty($_POST["meal"]))  echo $Msg4; ?>   <br>
    
     <label for="meal">Preferred meal:</label>
        <select id="meal" name="meal"  size="1">
          <option value=""> -- </option>
          <option value="std"> Standard </option>
          <option value="veg"> Vegetarian </option>
          <option value="vegan"> Vegan </option>
          <option value="gf"> Gluten-free </option>
          <option value="fruit"> Fruitarian </option>
          <option value="meat"> Meat-lovers - no vegetables </option>
          <option value="vegemite"> Vegemite sandwich </option>
        </select>
        <br>
<?php if ( isset($_POST["submit"]) && empty($_POST["inflight"]))  echo $Msg5; ?> <br>
        <p>What do you like to do during flights?<br>  
          <input type="checkbox" id="chbx1" name="inflight" value="snore"><label for="chbx1">Snore loudly</label><br>
          <input type="checkbox" id="chbx2" name="inflight" value="eat"><label for="chbx2">Eat messily</label><br>
          <input type="checkbox" id="chbx3" name="inflight" value="talk"><label for="chbx3">Talk to the person next to you</label><br>
          <input type="checkbox" id="chbx4" name="inflight" value="whinge"><label for="chbx4">Complain to the cabin crew</label><br>
          <input type="checkbox" id="chbx5" name="inflight" value="sleep"><label for="chbx5">Sleep in the aisle</label><br>
        </p>

        
    <br>

        <input type="submit" name= "submit" value="Submit">
        <input type="reset" value="Reset">
  </form>
</body>
</html>

Question 4------------------

 <!DOCTYPE html>
 <html lang="en">
 <head><meta charset="utf-8">
<title>weekten Exercise 3</title>
<link rel="stylesheet" href="styles.css">
<style type="text/css">
          table, td { border: 1px solid gray; padding:3px; }
          input[type="text"] { border: 1px solid black; }
      .error { color:red; }
    </style>
    
</head>
<body>

<?php
$numMsg = "";
    $prodMsg = "";
if (isset($_POST["quantity"])){

$val = $_POST["quantity"];

if (is_numeric($val))
{
require_once("conn.php");
$sql = "SELECT name, quantityInStock, price FROM product WHERE quantityInStock > $val
ORDER BY quantityInStock ASC";
$results =  $dbConn->query($sql)or
die ('Problem with query: ' . $dbConn->error);
}
elseif (!is_numeric($val)) {
echo '<span class="error">The value entered  for the quantity was not a number.</span>';
}}
?>

<?php if (isset($_POST["quantity"])&&$val<60 && is_numeric($val)) { ?>
<h1>Products with stock > <?php echo $val ?></h1>
<table>
<tr>

<th>Name</th>
<th>Quantity In Stock</th>
<th>Price</th>
</tr>    
       <?php
while ($row = $results->fetch_assoc()) { ?>
<tr>

<td><?php echo $row["name"]?></td>
<td><?php echo $row["quantityInStock"]?></td>
<td><?php echo $row["price"]?></td>
<!--output the other fields here from the $row array -->
</tr>

<?php }

$dbConn->close();
?>

</table>
<?php }elseif (isset($_POST["quantity"])&&is_numeric($val)) { ?>
 <?php  $prodMsg = '<span class="error">There are no products that have more than ' .$val . ' in stock <span>';?>
  <?php echo $prodMsg; ?>
<?php } ?>
</body>
</html>              

 

 

Edited by mahbub

Share this post


Link to post
Share on other sites

What does the error message say?

Please wrap your code in a code block so that it is easier to read.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...