Code: Select all
if(strlen($catno < 6)) error_message("6 Digit Value Needed");any ideas how i could improve this or any other ways to do it?
Moderator: General Moderators
Code: Select all
if(strlen($catno < 6)) error_message("6 Digit Value Needed");Code: Select all
if (strlen($catno) != 6 || !ctype_digit($catno)) {
// error
} else {
// ok
}Code: Select all
if(empty($qty)) error_message("No Qty Entered");Code: Select all
<?php
session_start();
require('page.inc');
require_once('update_delete_fns.php');
$editform = new Page();
$editform -> Display();
$catno = $_POSTї'cat_no'];
$title = $_POSTї'title'];
$artist = $_POSTї'artist_id'];
$release_date = $_POSTї'release_date'];
$genre = $_POSTї'genre_ref'];
$price = $_POSTї'price'];
$qty = $_POSTї'qty'];
$info = $_POSTї'comments'];
$oldcatno = $_POSTї'oldcatno'];
if(empty($title)) error_message("No Title Entered");
if(empty($price)) error_message("No Price Entered");
if(empty($qty)) error_message("No Qty Entered");
if(empty($info)) error_message("Please Enter some Information about the vinyl");
if (strlen($catno) != 6 || !ctype_digit($catno)) error_message("Catalogue value needs to be 6 digits");
if (filled_out($_POST))
{
$catno = $_POSTї'cat_no'];
$title = $_POSTї'title'];
$artist = $_POSTї'artist_id'];
$release_date = $_POSTї'release_date'];
$genre = $_POSTї'genre_ref'];
$price = $_POSTї'price'];
$qty = $_POSTї'qty'];
$status = $_POSTї'status_code'];
$info = $_POSTї'comments'];
$oldcatno = $_POSTї'oldcatno'];
if (update_vinyl($oldcatno, $catno, $title, $artist, $release_date, $genre, $price, $qty, $status, $info))
{
echo 'vinyl was updated.<br />';
}
else
echo 'vinyl could not be updated.<br />';
}
do_html_footer();
?>Code: Select all
<tr>
<td><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">Qty: </font></td>
<td><input name="qty" type="text" maxlength="3" id="qty" value="<?php echo $edit?$vinylї'stock_level']: ' '; ?>"></td>
</tr>