I am trying to write a script that includes if/else statements and functions. some background
-
$parts
first character should have the letter "N" -
$desc
is suppose to be at least one character long -
$price
needs to be positive (0 or higher)
if all three of theses requirements are met then it should say "data accepted" if something is not met (one or all) the "Invalid...." needs to show.
can someone tell me what part of my script I should look at.
<?php
$parts = $_POST["parts"];
$desc = $_POST["desc"];
$price = $_POST["price"];
$pa = substr($parts, 0, 1);
$de = strlen($desc);
if ($pa != "N")
{echo "Invalid Part Number";}
else
if ($de <= 1)
{echo "Invalid Description Length";}
else
if ($price <= 0)
{echo "Invalid Price";}
else
{echo "Data Accepted";}
?>