Jump to content


This topic is now archived and is closed to further replies.


One Code and Another Code and they won't work together - AAARRRGGHHH

Recommended Posts

I have a code called [b]uploadform.php[/b] and on this page you can fill out a form that will eventually become a csv file that you can manually load into an auction site for listings.  This page has a validation script in it and it is working properly.  When you press the submit button it processes the validation, and then I need for it to activate a second script called [b]upload2.php[/b].  This script creates a csv fileon the server, either creating a filename based on the user id you supplied on the form, or adding to the filename if it already exists.  Once it has created (added) to the file, it starts a third code called [b]uploadformconfirmation.html[/b] that is basically a confirmation page and you can select where you want to go next.

Currently I have this code working properly on an html form ([b]uploadform.html[/b]) but it doesn't have the validaton.  When I try to use the php form to do this, I have had to add the ob_start() in order to get it to process without an error caused by the location of the header.  I can get this form to validate and act like it is processing the data, but there is an error in that it isn't actually using the upload2.php code and creating or saving the file, even though I get the confirmation page that should indicate it has been saved. I enter the data and end up with nothing as the data hasn't been saved anywhere.  The only reason I know it isn't saving it as when I try to retrieve the data I get an error telling me there is no file by that name.

I can't figure out what to do different to get the [b]upload2.php[/b] code to work and save the data.  I am adding to this post the [b]uploadform.php[/b] code (the starting form),  the [b]upload2.php[/b] code (creates or saves the data) and the [b]uploadformconfirmation.html[/b] (this file is generated after the file is created or saved).  I will also include the [b]uploadform.html[/b] for reference.

I appreciate any help as I am totally baffled by this, seeing as I have it working, but not with validation.

<?php ob_start();
/* uploadform.php */

require_once ('functions.php');
$categories = array("000" =>'Please Select Category',
                              "150" =>'Antiques',
                              113 =>"Arts and Crafts",
                                20 =>"Automobiles - Antique Vehicles",
                                18 =>"Automobiles - Cars",
                                21 =>"Automobiles - Hot Rod Vehicles",
                                19 =>"Automobiles - Trucks",
                                52 =>"Automotive Parts and Accessories - New Parts",
                                51 =>"Automotive Parts and Accessories - Used Parts",
                              134 =>"Automotive Stereos and Radar Detectors",
                              140 =>"Bicycles - Single Speed",
                              141 =>"Bicycles - 10 Speed and Under",
                              142 =>"Bicycles - 18 Speed",
                              143 =>"Bicycles - Over 18 Speed",
                              144 =>"Bicycles - Unicycles",
                              145 =>"Bicycles - Scooters",
                              146 =>"Bicycles - Childrens Trikes",
                              147 =>"Bicycles - Children Bikes with Training Wheels",
                                84 =>"Cameras - Digital Camera",
                                85 =>"Cameras - Camcorders",
                                86 =>"Cameras - Others",
                              167=>"Collector Coins",
                              149 =>"Community Meetings",
                                87 =>"Computers and Accessories - Monitors",
                                88 =>"Computers and Accessories - Printers",
                                89 =>"Computers and Accessories - CPU's",
                                90 =>"Computers and Accessories - Complete Systems",
                                91 =>"Computers and Accessories - Accessories",
                              103 =>"Computers and Accessories - Services",
                              105 =>"Construction - Services",
                              106 =>"Construction - Equipment",
                              107 =>"Construction - Tools",
                              109 =>"Construction - Products - New",
                              110 =>"Construction - Products - Used",
                                74 =>"Employment Ads - General",
                              120 =>"Employment Ads - General Labourer",
                                72 =>"Employment Ads - Professional",
                              119 =>"Employment Ads - Restaurant",
                              118 =>"Employment Ads - Retail",
                                73 =>"Employment Ads - Trades",
                                66 =>"Farm / Livestock / Equipment - Feed",
                                65 =>"Farm / Livestock / Equipment - Livestock",
                                64 =>"Farm / Livestock / Equipment - Mowers",
                                63 =>"Farm / Livestock / Equipment - Tillers",
                                62 =>"Farm / Livestock / Equipment - Tractors",
                              168 =>"Health and Wellness",
                                96 =>"Home Electronics - DVD and VCR",
                                92 =>"Home Electronics - Gaming Machines",
                                97 =>"Home Electronics - MP3, Discman, etc.",
                              135 =>"Home Electronics - Telephone",
                                77 =>"Home and Garden - Gardening Tools and small equipment",
                                75 =>"Home and Garden - Lawnmowers",
                                76 =>"Home and Garden - Rototillers",
                                78 =>"Home and Garden - Services",
                                79 =>"Home and Garden - Sheds",
                              154 =>"Household Goods - Appliances",
                              155 =>"Household Goods - Bar - B - Q",
                              156 =>"Household Goods - Bedroom Furniture",
                              152 =>"Household Goods - Furniture",
                              151 =>"Household Goods - Kitchen",
                              153 =>"Household Goods - Small Appliances",
                              154 =>"Household Goods - Appliances",
                                61 =>"Houses for Sale - Acreages",
                                35 =>"Homes for Sale - Condo",
                                33 =>"Homes for Sale - Duplex",
                                32 =>"Homes for Sale - Houses",
                                36 =>"Homes for Sale - Mobile Homes",
                                34 =>"Homes for Sale - Townhouse",
                                71 =>"Housing Rentals - Acreages",
                                39 =>"Housing Rentals - Apartments",
                                42 =>"Housing Rentals - Condo",
                                44 =>"Housing Rentals - Duplex",
                                40 =>"Housing Rentals - Houses",
                                43 =>"Housing Rentals - Mobile Home",
                                41 =>"Housing Rentals - Townhouse",
                              132 =>"Jewellery and Watches - Beaded Jewellery",
                              131 =>"Jewellery and Watches - Rings",
                              133 =>"Jewellery and Watches - Engagement and Wedding",
                              130 =>"Jewellery and Watches - Watches",
                                53 =>"Motorcycles - ATV",
                                22 =>"Motorcycle - OFF ROAD",
                                23 =>"Motorcycle - Street Legal",
                                54 =>"Motorcycle Parts and Accessories - Apparel",
                                56 =>"Motorcycle Parts and Accessories - Boots",
                                58 =>"Motorcycle Parts and Accessories - Equipment and Tools",
                                55 =>"Motorcycle Parts and Accessories - Helmuts",
                                59 =>"Motorcycle and ATV Parts - New",
                                60 =>"Motorcycle Parts and Accessories - Used",
                              137 =>"Personal Care Products",
                              121 =>"Pets",
                                27 =>"Recreational Vehicle - 5th Wheels",
                                26 =>"Recreational Vehicle - Motor Homes",
                                24 =>"Recreational Vehicle - Tent Trailer",
                                25 =>"Recreational Vehicle - Trailers",
                              159 =>"Renovations - Bathroom",
                              162 =>"Renovations - Bedroom",
                              164 =>"Renovations - Electrical",
                              160 =>"Renovations - Kitchen",
                              161 =>"Renovations - Living Areas",
                              163 =>"Renovations - Plumbing",
                              165 =>"Renovations - Wholesalers",
                              165 =>"Services - Child Care",
                              127 =>"Services - Moving and Storage",
                              122 =>"Services - Professional",
                              123 =>"Services - Tradesman",
                              126 =>"Services - Yard Care and Snow Removal",
                              166 =>"Services - Renovation Contractors",
                                95 =>"Stereos - All in One",
                                94 =>"Stereos - Components",
                                93 =>"Stereos - Speakers",                                                                            98 =>"Televisions - Flat Screen",
                                98 =>"Televisions - Flat Screen",
                                99 =>'Televisions - Under 20"',
                              100 =>"Televisions - 20 inch and over",
                              101 =>"Televisions - Plasma",
                              102 =>"Televisions - Projection",
                              148 =>"Tools",
                              138 =>"Toys",
                                46 =>"Upcoming Events - Coaldale",
                                47 =>"Upcoming Events - Coalhurst",
                                49 =>"Upcoming Events - Fort McLeod",
                                45 =>"Upcoming Events - Lethbridge",
                                48 =>"Upcoming Events - Taber",
                                50 =>"Upcoming Events - Surrounding Areas",
                              128 =>"WANT ADS");
$valid = TRUE;
$err = array();
$err_msg = array();
$funcs = array('id'=>'LettersAndDigits',
                                        'item_title' => 'Variable',
                                        'item_type' => 'Variable',
                                        'quantity_available' => 'isDigits',
                                        'starting_bid' => 'Dollars',
                                        'bid_increment' => 'BidIncrement',
                                        'reserve_price' => 'ReservePrice',
                                        'duration' => 'isDigits',
                                        'end_time' => 'isDigits',
                                        'auto_relist' => 'isLetters',
                                        'city' => 'Variable',
                                        'state' => 'Variable',
                                        'country' => 'Variable',
                                        'item_description' => 'Variable',
                                        'paypal_id' => 'EmailorEmpty',
                                        'hit_counter' => 'Variable');
$hc = array(0=> 'No Counter',
            1=> 'Style 1',
            2=> 'Style 2',
            3=> 'Style 3');
$itemType = array(1=> 'Auction',
                  2=> 'Dutch Auction',
                  3=> 'Fixed Price',
                  4=> 'Classified Ad');
$countries = array(32=>'Canada',210=>'USA');
$yesno = array(1=>'Yes',0=>'No');
$hours = array(24 =>'12:00 a.m.',
                                        1 =>'1:00 a.m.',
                                        2 =>'2:00 a.m.',
                                        3 =>'3:00 a.m.',
                                        4 =>'4:00 a.m.',
                                        5 =>'5:00 a.m.',
                                        6 =>'6:00 a.m.',
                                        7 =>'7:00 a.m.',
                                        8 =>'8:00 a.m.',
                                        9 =>'9:00 a.m.',
                                        10 =>'10:00 a.m.',
                                        11 =>'11:00 a.m.',
                                        12 =>'12:00 p.m.',
                                        13 =>'1:00 p.m.',
                                        14 =>'2:00 p.m.',
                                        15 =>'3:00 p.m.',
                                        16 =>'4:00 p.m.',
                                        17 =>'5:00 p.m.',
                                        18 =>'6:00 p.m.',
                                        19 =>'7:00 p.m.',
                                        20 =>'8:00 p.m.',
                                        21 =>'9:00 p.m.',
                                        22 =>'10:00 p.m.',
                                        23 =>'11:00 p.m.');

if (isset ($_POST['Submit'])) {
        $valid = true;
        foreach($_POST as $key=>$val) {
                if ($key != 'Submit') {
                        switch ($funcs[$key]) {
                                case 'LettersAndDigits':
                                        if (!LettersAndDigits($val)) $err[] = $key;
                                case 'Variable':
                                        if (!Variable($val)) $err[] = $key;
                                case 'Dollars':
                                        if (!Dollars($val)) $err[] = $key;
                                case 'ItemCategory':
                                        $ic = ItemCategory($val);
                                        if (!$ic[0]) {
                                                $err[] = $key;
                                                $err_msg[$key] = $ic[1];
                                case 'isDigits':
                                        if (!isDigits($val)) $err[] = $key;
                                case 'EmailorEmpty':
                                        if (!EmailorEmpty($val)) $err[] = stripslashes($key);
                                case 'BidIncrement':
                                        $bi = BidIncrement($val,$itemType[$_POST['item_type']]);
                                        if (!$bi[0]) {
                                                $err[] = $key;
                                                $err_msg[$key] = $bi[1];
                                case 'ReservePrice':
                                        $rp = ReservePrice($val,$itemType[$_POST['item_type']]);
                                        if (!$rp[0]) {
                                                $err[] = $key;
                                                $err_msg[$key] = $rp[1];

                if (!empty($err)) $valid = false;

    if ($valid) {
            header ("Location: upload2.php");

function disp_val($idx) {
        $retv = '';
        if (isset($_POST[$idx])) $retv = stripslashes($_POST[$idx]);

function is_selected($it,$val,$def='') {
        if (isset($_POST[$it]))
                $ret =($_POST[$it] == $val)?' selected ':'';
                $ret = ($val == $def)?' selected':'';

function disp_options($opt_array,$fld,$def,$for_type) {
        $tmp = array();
        if ($for_type)
                foreach ($opt_array as $key=>$val)
                        $tmp[] = '<option value="' . $key . '"' . is_selected($fld,$key,$def) . '>' . $val . '</option>';
                for ($i=0;$i<count($opt_array);$i++)
                        $tmp[] = '<option value="' . $i . '"' . is_selected($fld,$i,$def) . '>' . $opt_array[$i] . '</option>';
        echo "\t\t" . implode("\n\t\t",$tmp) . "\n";
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<title>For Sale 4 U QUICK LISTER</title>
<style type="text/css">
body {
        background-color: Gainsboro;
        margin: 0;
        padding: 0;
        font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
        font-size: 72%;
        color: black;
table {
        width: 96%;
        display: block;
        margin-left: auto;
        margin-right: auto;

form {
        width: 98%;
        display: block;
        margin-left: auto;
        margin-right: auto;
.red {
        color: Red;
.error {color:#C03; font-weight:bold; }

h3 {
        text-align: center;
        color: Red;
        font-weight: bold;
h4 {
        text-align: center;
        color: Blue;
        font-weight: bold;
.center {
        text-align: center;

.bold {
        font-weight: bold;
<h3>Quick Lister</h3>
<p class="center"><span class="red">For Sale 4 U - Canada's Online Auction</span></p>
<p class="center"><span class="bold">Please note:&nbsp; </span>You may
not use characters such as $, #, &quot;, &amp;, *,/, etc.&nbsp; It is best to use normal
text and numerical characters only.&nbsp;<BR><BR><BR>
$trace = array();
if (!$valid) {
<h4>Please correct the items in <span class="error">red</span> and resubmit.<br /><br /> </h4>
<form method="POST" action="uploadform.php">
    <td valign="top" <?php if(in_array('id',$err)) echo 'class="error"'; ?>> User ID:</td>
    <td><input type="text" name="id" size="12" value="<?php echo  disp_val('id') ?>"><br>
    You must use the <span class="bold">same User ID</span> for all items you are uploading during this session.(It does not have to be your regular username.)</td>
    <td <?php if(in_array('item_title',$err)) echo 'class="error"'; ?>>  Item Title:</td>
    <td><input type="text" name="item_title" size="60" value="<?php echo  disp_val('item_title'); ?>"</td>
    <td <?php if(in_array('item_category',$err)) echo 'class="error"'; ?>>Item Category:</td>
    <td> <select size="1" name="item_category">
        <?php disp_options($categories,'item_category','',true) ?>
          <? if (isset($err_msg['item_category'])) echo '&nbsp;<span
          class="error">' . $err_msg['item_category'] . '</span>'; ?>
    <td <?php if(in_array('item_type',$err)) echo 'class="error"'; ?>>Item Type:</td>
    <td><select size="1" name="item_type">
                        $tmp = array();
                        for ($i=1;$i<count($itemType)+1;$i++)
                                $tmp[] = '<option value="' . $i . '"' . is_selected('item_type',$i,0) . '>' . $itemType[$i] . '</option>';
                        echo "\t\t" . implode("\n\t\t",$tmp) . "\n";
<tr><td <?php if(in_array('quantity_available',$err)) echo 'class="error"'; ?>>Quantity:</td>
    <td><input type="text" name="quantity_available" size="3" value="<?php echo  disp_val('quantity_available') ?>"</td></tr>
    <td <?php if(in_array('starting_bid',$err)) echo 'class="error"'; ?>>Starting Bid:</td>
    <td> <input type="text" name="starting_bid" size="7" value="<?php echo  disp_val('starting_bid') ?>"></td>
    <td <?php if(in_array('bid_increment',$err)) echo 'class="error"'; ?>>Bid Increment (auction only):</td>
    <td><input type="text" name="bid_increment" size="7" value="<?php echo  disp_val('bid_increment') ?>"><? if (isset($err_msg['bid_increment'])) echo '&nbsp;<span class="error">' . $err_msg['bid_increment'] . '</span>'; ?></td>
    <td <?php if(in_array('reserve_price',$err)) echo 'class="error"'; ?>>Reserve Bid&nbsp;(auction only ):</td>
    <td><input type="text" name="reserve_price" size="7" value="<?php echo  disp_val('reserve_price') ?>"><? if (isset($err_msg['reserve_price'])) echo '&nbsp;<span class="error">' . $err_msg['reserve_price'] . '</span>'; ?></td>
    <td <?php if(in_array('duration',$err)) echo 'class="error"'; ?>>Ad Duration:</td>
    <td><select size="1" name="duration">
        <?php $tmp = array();
                for ($d=1;$d<31;$d++)
                        $tmp[] = '<option value="' . $d . '"' . is_selected('duration',$d,'14') .'>' . $d . '</option>';
                echo "\t\t" . implode("\n\t\t",$tmp) . "\n";
    <td <?php if(in_array('end_hour',$err)) echo 'class="error"'; ?>>End Time:</td>
    <td> <select size="1" name="end_hour">
        <?php disp_options($hours,'end_hour',20,true); ?>
    <tr><td <?php if(in_array('auto_relist',$err)) echo 'class="error"'; ?>>Auto Relist:</td>
    <td><select size="1" name="auto_relist">
        <?php disp_options($yesno,'auto_relist',1,true); ?>
    <td <?php if(in_array('city',$err)) echo 'class="error"'; ?>>City:</td>
    <td><input type="text" name="city" size="15" value="<?php echo  disp_val('city') ?>"> </td>
    <td <?php if(in_array('state',$err)) echo 'class="error"'; ?>>Province/State:</td>
    <td><input type="text" name="state" size="10" value="<?php echo  disp_val('state') ?>"></td>
    <td <?php if(in_array('country',$err)) echo 'class="error"'; ?>>Country:</td>
    <td><select size="1" name="country">
                <?php disp_options($countries,'country',32,true) ?>
    <td valign="top" <?php if(in_array('item_description',$err)) echo 'class="error"'; ?>>Item Description:</td>
    <td colspan=8><textarea rows="4" name="item_description" cols="116"><?php echo  disp_val('item_description') ?></textarea></td>
      <td <?php if(in_array('paypal_id',$err)) echo 'class="error"'; ?>>Paypal ID (Optional):</td>
                <td><input type="text" name="paypal_id" size="25" value="<?php echo  disp_val('paypal_id') ?>">
      <td <?php if(in_array('hit_counter',$err)) echo 'class="error"'; ?>>Hit Counter:</td>
                <td><select size="1" name="hit_counter">
                <?php disp_options($hc,'hit_counter',0,true); ?>
        <td colspan="2"><hr></td>
    <td colspan="5" class="center">
        <span class="bold"><br>Please verify all details shown for your item before pressing the SAVE button.</span>
    <td colspan="5" class="center"><br><input type="submit" name="Submit" value="SAVE  ITEM"></td>
    <td colspan="2" class="center"><BR>You will be guided through this Multi Step Process.  Please be sure
        to use the <span class="bold">same User ID</span> when entering your items or they will not all
        be listed correctly.</font></p>



$flds = array('item_title','item_category','item_type','quantity_available','starting_bid/price','bid_increment','reserve_price','duration','auto_relist','city','state','country','item_description','paypal_id','hit_counter','end_hour');
$write_to_csv = 'UploadForm/' . $_POST['id'] . '.csv';
if (!file_exists($write_to_csv)) { // only write the header if the file doesn't already exist
  $fp = fopen($write_to_csv,'a');
  fwrite($fp,implode(',',$flds)."\n"); // write the field names separated by commas
  fclose($fp); }
$fp = fopen($write_to_csv,'a');
$tmp = array();
foreach($flds as $fld)
    $tmp[] = '"' . $_POST[$fld] . '"'; //these quotes are single-double-single

fwrite($fp,implode(',',$tmp)."\n"); // write to the file
header("Location: http://www.forsale4u.ca/uploadformconfirmation.html");

Share this post

Link to post
Share on other sites


<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Item Upload Confirmation</title>

<body bgcolor="#F5F3F5">

<div align="center">
        <div align="center">
                <table border="0" width="100%" cellspacing="0" cellpadding="0" id="table4">
                                <p align="center"><b><font size="5" color="#0000FF">Quick Lister</font></b></p>
                                <p align="center"><b><font color="#FF0000">For Sale 4 U -
                                Canada's Online Auction</font></b></td>
        <table border="0" width="75%" cellspacing="0" cellpadding="0" id="table1">
                        <td style="color: #000000">
                        <p align="center">&nbsp;</p>
                        <p align="center"><b><font size="5">Your item has been successfully
                        <div align="center">
                                <table border="0" width="95%" id="table2" cellspacing="0" cellpadding="0">
                                                <td width="36%"><b>
                                                <a href="http://www.forsale4u.ca/uploadform.html">
                                                <font color="#FF0000">Add
                                                Another Item</font></a></b><p><font size="2"><b>Be sure
                                                to use the same User ID</b></font></td>
                                                <td width="33%">
                                                <p align="center"><font color="#0000FF"><b>Please select
                                                one of these two options</b></font></td>
                                                <td width="36%"><b>
                                                <p align="right"<a href="http://www.forsale4u.ca/uploadresults.php">
                                                <a href="uploadresults.php"><font color="#FF0000">Retrieve Saved Data</font></a><p align="right"<a href="http://www.forsale4u.ca/uploadresults.php">
                                                <font size="2">Remember the User ID you entered</font></b></td>
<HR><div align="center">
        <table border="0" width="67%" id="table3" cellspacing="0" cellpadding="0">
                        <td>&nbsp;<p><font size="2">If you have more items to add, please select<b>
                        <font color="#FF0000">
                        <a href="http.www.forsale4u.ca/uploadform.html">Add
                        Another Item</a></font></b><font color="#FF0000">.&nbsp;</font> Please make sure you
                        <font color="#FF0000"> <b>use the same</b></font>
                        User ID.</font></p>
                        <p><font size="2">If you do not have any more items to add, please select&nbsp;
                        <font color="#FF0000"> <b>
                        <a href="http://www.forsale4u.ca/uploadresults.php">Retrieve Saved Data</a></b> </font>and you will be able to save this
                        information to your computer in a csv file format.&nbsp; You will
                        need to know the User ID you entered.</font></p>



<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>For Sale 4 U Multiple Listing Upload Form</title>
<body bgcolor="#F5F3F5">
<p align="center"><b><font face="Arial" size="4" color="#0000FF">Quick Lister</font></b></p>
<p align="center"><b><font face="Arial" color="#FF0000">For Sale 4 U - Canada's
Online Auction</font></b></p>
<p align="left"><font face="Arial" size="2"><b>Please note:&nbsp; </b>You may
not use characters such as $, #, &quot;, &amp;, *,/, etc.&nbsp; It is best to use normal
text and numerical characters only.&nbsp; If you use a character that is not
permitted, the item will not be successfully uploaded when you attempt to upload
it to the For Sale 4 U Site after you have listed all of your items.<BR>
<b>All fields must be filled in</b> except for PayPal ID.  If you are using a Fixed Price Listing or Classifed Ad you may leave the Bid Increment and Reserve Price empty.  If you do not fill in all fields your listing will be rejected when you try to upload it into the For Sale 4 U Multiple Listing.
<form action="upload2.php" method="POST"
        <font size="2">
        <p>User ID </font> <font size="3">
        &nbsp;<font face="Arial"><input type="text" name="id" size="12"></font></font>&nbsp;&nbsp;
        <font size="2">You must use the <font color="#FF0000">same User ID</font> for all items you are
        uploading during this session.</font> <font size="2">(It does not have to be
        your regular username.) </font></p>
        <p><font face="Arial"><font size="2">Item Title </font> <font size="3">
        &nbsp;<input type="text" name="item_title" size="73"></font><font size="2">&nbsp;
        Category: </font><select size="1" name="item_category">
        <option value="000">Please Select Category</option>
        <option value="150">Antiques</option>
        <option value="113">Arts and Crafts</option>
        <option value="20">Automobiles - Antique Vehicles</option>
        <option value="18">Automobiles - Cars</option>
        <option value="21">Automobiles - Hot Rod Vehicles</option>
        <option value="19">Automobiles - Trucks</option>
        <option value="52">Automotive Parts and Accessories - New Parts</option>
        <option value="51">Automotive Parts and Accessories - Used Parts</option>
        <option value="134">Automotive Stereos and Radar Detectors</option>
        <option value="140">Bicycles - Single Speed</option>
        <option value="141">Bicycles - 10 Speed and Under</option>
        <option value="142">Bicycles - 18 Speed</option>
        <option value="143">Bicycles - Over 18 Speed</option>
        <option value="144">Bicycles - Unicycles</option>
        <option value="145">Bicycles - Scooters</option>
        <option value="146">Bicycles - Childrens Trikes</option>
        <option value="147">Bicycles - Children Bikes with Training Wheels</option>
        <option value="84">Cameras - Digital Camera</option>
        <option value="85">Cameras - Camcorders</option>
        <option value="86">Cameras - Others</option>
        <option value="167">Collector Coins</option>
        <option value="149">Community Meetings</option>
        <option value="87">Computers and Accessories - Monitors</option>
        <option value="88">Computers and Accessories - Printers</option>
        <option value="89">Computers and Accessories - CPU's</option>
        <option value="90">Computers and Accessories - Complete Systems</option>
        <option value="91">Computers and Accessories - Accessories</option>
        <option value="103">Computers and Accessories - Services</option>
        <option value="105">Construction - Services</option>
        <option value="106">Construction - Equipment</option>
        <option value="107">Construction - Tools</option>
        <option value="109">Construction - Products - New</option>
        <option value="110">Construction - Products - Used</option>
        <option value="74">Employment Ads - General</option>
        <option value="120">Employment Ads - General Labourer</option>
        <option value="72">Employment Ads - Professional</option>
        <option value="119">Employment Ads - Restaurant</option>
        <option value="118">Employment Ads - Retail</option>
        <option value="73">Employment Ads - Trades</option>
        <option value="66">Farm / Livestock / Equipment - Feed</option>
        <option value="65">Farm / Livestock / Equipment - Livestock</option>
        <option value="64">Farm / Livestock / Equipment - Mowers</option>
        <option value="63">Farm / Livestock / Equipment - Tillers</option>
        <option value="62">Farm / Livestock / Equipment - Tractors</option>
        <option value="168">Health and Wellness</option>
        <option value="136">Home Electronics</option>
        <option value="96">Home Electronics - DVD and VCR</option>
        <option value="92">Home Electronics - Gaming Machines</option>
        <option value="97">Home Electronics - MP3, Discman, etc.</option>
        <option value="135">Home Electronics - Telephone</option>
        <option value="77">Home and Garden - Gardening Tools and small equipment</option>
        <option value="75">Home and Garden - Lawnmowers</option>
        <option value="76">Home and Garden - Rototillers</option>
        <option value="78">Home and Garden - Services</option>
        <option value="79">Home and Garden - Sheds</option>
        <option value="154">Household Goods - Appliances</option>
        <option value="155">Household Goods - Bar - B - Q</option>
        <option value="156">Household Goods - Bedroom Furniture</option>
        <option value="152">Household Goods - Furniture</option>
        <option value="151">Household Goods - Kitchen</option>
        <option value="153">Household Goods - Small Appliances</option>
        <option value="61">Houses for Sale - Acreages</option>
        <option value="35">Houses for Sale - Condo</option>
        <option value="33">Houses for Sale - Duplex</option>
        <option value="32">Houses for Sale - Houses</option>
        <option value="36">Houses for Sale - Mobile Homes</option>
        <option value="34">Houses for Sale - Townhouse</option>
        <option value="39">Housing Rentals - Apartments</option>
        <option value="42">Housing Rentals - Condo</option>
        <option value="44">Housing Rentals - Duplex</option>
        <option value="40">Housing Rentals - Houses</option>
        <option value="43">Housing Rentals - Mobile Home</option>
        <option value="41">Housing Rentals - Townhouse</option>
        <option value="132">Jewellery and Watches - Beaded Jewellery</option>
        <option value="131">Jewellery and Watches - Rings</option>
        <option value="133">Jewellery and Watches - Engagement and Wedding</option>
        <option value="130">Jewellery and Watches - Watches</option>
        <option value="53">Motorcycles - ATV</option>
        <option value="22">Motorcycle - OFF ROAD</option>
        <option value="23">Motorcycle - Street Legal</option>
        <option value="54">Motorcycle Parts and Accessories - Apparel</option>
        <option value="56">Motorcycle Parts and Accessories - Boots</option>
        <option value="58">Motorcycle Parts and Accessories - Equipment and Tools
        <option value="55">Motorcycle Parts and Accessories - Helmuts</option>
        <option value="59">Motorcycle Parts and Accessories - New</option>
        <option value="60">Motorcycle Parts and Accessories - Used</option>
        <option value="137">Personal Care Products</option>
        <option value="121">Pets</option>
        <option value="27">Recreational Vehicle - 5th Wheels</option>
        <option value="26">Recreational Vehicle - Motor Homes</option>
        <option value="24">Recreational Vehicle - Tent Trailer</option>
        <option value="25">Recreational Vehicle - Trailers</option>
        <option value="26">Recreational Vehicle - Motor Homes</option>
        <option value="159">Renovations - Bathroom </option>
        <option value="162">Renovations - Bedroom </option>
        <option value="164">Renovations - Electrical </option>
        <option value="160">Renovations - Kitchen </option>
        <option value="161">Renovations - Living Areas </option>
        <option value="163">Renovations - Plumbing </option>
        <option value="165">Renovations - Wholesalers </option>
        <option value="124">Services - Child Care</option>
        <option value="127">Services - Moving and Storage</option>
        <option value="122">Services - Professional</option>
        <option value="123">Services - Tradesman</option>
        <option value="126">Services - Yard Care and Snow Removal</option>
        <option value="166">Services - Renovation Contractors</option>
        <option value="95">Stereos - All in One</option>
        <option value="94">Stereos - Components</option>
        <option value="93">Stereos - Speakers</option>
        <option value="99">Televisions - Under 20"</option>
        <option value="100">Televisions - 20 inch and over</option>
        <option value="98">Televisions - Flat Screen</option>
        <option value="101">Televisions - Plasma</option>
        <option value="102">Televisions - Projection</option>
        <option value="148">Tools</option>
        <option value="138">Toys</option>
        <option value="46">Upcoming Events - Coaldale</option>
        <option value="47">Upcoming Events - Coalhurst</option>
        <option value="49">Upcoming Events - Fort McLeod</option>
        <option value="45">Upcoming Events - Lethbridge</option>
        <option value="48">Upcoming Events - Taber</option>
        <option value="50">Upcoming Events - Surrounding Areas</option>
        <option value="128">WANT ADS</option>
        <p><font face="Arial"><font size="2">Item Type </font> <font size="3">
        &nbsp;<select size="1" name="item_type">
        <option selected value="1">Auction</option>
        <option value="2">Dutch Auction</option>
        <option value="3">Fixed Price</option>
        <option value="4">Classified Ad</option>
        </select></font><font size="2">&nbsp;&nbsp; Quantity </font> <font size="3">
        &nbsp;<input type="text" name="quantity_available" size="4"></font><font size="2">&nbsp; Starting Bid
        <font size="3">

        <input type="text" name="starting_bid/price" size="8"></font><font size="2">&nbsp;&nbsp; Bid Increment (auction only )
        </font> <font size="3">
        &nbsp;<input type="text" name="bid_increment" size="8"></font><font size="2">&nbsp;&nbsp; Reserve Bid&nbsp;
        (auction only ) </font> <font size="3">
        &nbsp;<input type="text" name="reserve_price" size="8"></font><font size="2"> </font> </font></p>
        <p><font face="Arial"><font size="2">Ad Duration-&nbsp;
        <select size="1" name="duration">
        <option value="1">1</option>
        <option value="2">2</option>
        <option value="3">3</option>
        <option value="4">4</option>
        <option value="5">5</option>
        <option value="6">6</option>
        <option value="7">7</option>
        <option value="8">8</option>
        <option value="9">9</option>
        <option value="10">10</option>
        <option value="11">11</option>
        <option value="12">12</option>
        <option value="13">13</option>
        <option value="14" selected>14</option>
        <option value="15">15</option>
        <option value="16">16</option>
        <option value="17">17</option>
        <option value="18">18</option>
        <option value="19">19</option>
        <option value="20">20</option>
        <option value="21">21</option>
        <option value="22">22</option>
        <option value="23">23</option>
        <option value="24">24</option>
        <option value="25">25</option>
        <option value="26">26</option>
        <option value="27">27</option>
        <option value="28">28</option>
        <option value="29">29</option>
        <option value="30">30</option>
        End Time :&nbsp;&nbsp;
                <select size="1" name="end_hour">
        <option value="24">12:00 a.m.</option>
        <option value="1">1:00 a.m.</option>
        <option value="2">2:00 a.m.</option>
        <option value="3">3:00 a.m.</option>
        <option value="4">4:00 a.m.</option>
        <option value="5">5:00 a.m.</option>
        <option value="6">6:00 a.m.</option>
        <option value="7">7:00 a.m.</option>
        <option value="8">8:00 a.m.</option>
        <option value="9">9:00 a.m.</option>
        <option value="10">10:00 a.m.</option>
        <option value="11">11:00 a.m.</option>
        <option value="12">12:00 p.m.</option>
        <option value="13">1:00 p.m.</option>
        <option value="14">2:00 p.m.</option>
        <option value="15">3:00 p.m.</option>
        <option value="16">4:00 p.m.</option>
        <option value="17">5:00 p.m.</option>
        <option value="18">6:00 p.m.</option>
        <option value="19">7:00 p.m.</option>
        <option value="20" selected>8:00 p.m.</option>
        <option value="21">9:00 p.m.</option>
        <option value="22">10:00 p.m.</option>
        <option value="23">11:00 p.m.</option>
        </select>&nbsp;&nbsp;&nbsp;&nbsp;Auto Relist <font size="3"><select size="1" name="auto_relist">
        <option value="1" selected>Yes</option>
        <option value="0">No</option>
        </select>&nbsp; </font><font size="2">&nbsp; City </font> <font size="3">
        &nbsp;<input type="text" name="city" size="15"></font><font size="2">&nbsp;&nbsp;&nbsp; Province/State </font> <font size="3">
        &nbsp;<input type="text" name="state" size="14"></font><font size="2">&nbsp;&nbsp; Country </font> <font size="3"><select size="1" name="country">
        <option selected value="32">Canada</option>
        <option value="210">USA</option>
        </select></font><font size="2">&nbsp;&nbsp;&nbsp;&nbsp; </font></font></p>
        <p><font face="Arial"><font size="2">Item Description </font> <font size="3">
        &nbsp;<textarea rows="4" name="item_description" cols="108"></textarea></font></font></p>
        <p align="center"><font face="Arial"><font size="2">&nbsp;Paypal ID (Optional)</font><font size="3"><input type="text" name="paypal_id" size="25"></font><font size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
        Hit Counter</font><font size="3"><select size="1" name="hit_counter">
        <option selected value="0">No Counter</option>
        <option value="1">Style 1</option>
        <option value="2">Style 2</option>
        <option value="3">Style 3</option>
        <p><b><font face="Arial" size="2" color="#FF0000">Please verify all details listed for your item
        before pressing the submit button.</font></b></p>
        <input type="submit" name="Submit" value="Save Item" /><BR> <font size="2">
        Directions will guide you through this multi step process.&nbsp; If you have
        more items to list, you will be returned to this page.&nbsp; It is important that you use the same USER ID for each item or you will not end up with a Quick Lister File that will contain all of your items!</font></p>



function isDigits($element) {                      //numbers only
  if (strlen(stripslashes(trim($element))) == 0)
    return (false);
  return !preg_match ("/[^0-9]/", $element);

function Dollars($element) {                        //numbers and decimal
  if (strlen(stripslashes(trim($element))) == 0)
    return (false);
  return !preg_match ("/[^0-9.]/", $element);

function isLetters($element) {                      //letters only
  if (strlen(stripslashes(trim($element))) == 0)
    return (false);
  return !preg_match ("/[^A-z]/", $element);

function LetandNumOnly($element) {                  //Letters and Numbers
  if (strlen(stripslashes(trim($element))) == 0)    //with No Spaces
    return (false);
  return !preg_match ("/[^A-z0-9]/", $element);

function LettersAndDigits($element) {              //Letters, Numbers
  if (strlen(stripslashes(trim($element))) == 0)    //and Spaces
    return (false);
  return !preg_match ("/[^A-z0-9 ]/", $element);

function Variable($element) {                      //letters, numbers, spaces
  if (strlen(stripslashes(trim($element))) == 0)    //commas and periods only
    return (false);
  return !preg_match ("/[^A-z0-9,.? ]/", $element);


function checkLength($string, $min, $max) {        //Check the Length
  $length = strlen ($string);                      //min and max
  if (($length < $min) || ($length > $max)) {
    return FALSE;
  } else {
    return TRUE;

function checkMailCode($code, $country) {          //Check Postal Code
  $code = preg_replace("/[\s|-]/", "", $code);      //by Country
  $length = strlen ($code);
  switch (strtoupper ($country)) {
    case 'US':
      if (($length <> 5) && ($length <> 9)) {
        return FALSE;
      return isDigits($code);
    case 'CA':
      if ($length <> 6) {
        return FALSE;
      return preg_match ("/([A-z][0-9]){3}/", $code);

function checkURL($url) {                          //check valid URL Format
  return preg_match ("/http:\/\/(.*)\.(.*)/i", $url);

function checkURLandConnect($url) {                //Check Valid URL and
  if (!preg_match ("/http:\/\/(.*)\.(.*)/i", $url)) {//Confirm by Connecting
    return FALSE;
  $parts = parse_url($url);
  $fp = fsockopen($parts['host'], 80, $errno, $errstr, 10);
  if(!$fp) {
    return FALSE;
  return TRUE;

function checkEmail($email) {                      //Check Email Format
  $pattern = "/^[A-z0-9\._-]+"
        . "@"
        . "[A-z0-9][A-z0-9-]*"
        . "(\.[A-z0-9_-]+)*"
        . "\.([A-z]{2,6})$/";
  return preg_match ($pattern, $email);

function EmailorEmpty($email) {                    //Check Email Format
    if(empty($email)) {                            //or empty field
        return true;
    } else {
        $pattern = "/^[A-z0-9\._-]+"
        . "@"
        . "[A-z0-9][A-z0-9-]*"
        . "(\.[A-z0-9_-]+)*"
        . "\.([A-z]{2,6})$/";
        return preg_match ($pattern, $email);

function checkPassword($password) {                //check password for minimum
  $length = strlen ($password);                    //of 8 characters and must
  if ($length < 8) {                                //have a number between letters
    return FALSE;                                  //and a variation of letters
  $unique = strlen (count_chars ($password, 3));
  $difference = $unique / $length;
  if ($difference < .60) {
    return FALSE;
  return preg_match ("/[A-z]+[0-9]+[A-z]+/", $password);

function BidIncrement($bi,$it)  {
        $ret = array(true,'');
  if($it == "Auction" || $it =="Dutch Auction")  {
    if(!(is_numeric($bi)) || empty($bi)){
        $ret = array(false, "You have not entered a Valid Bid Increment");
    elseif($it == "Fixed Price" || $it =="Classified Ad"){
                        $ret = array(false, "A Bid Increment cannot be entered for this Type of Listing.");
        return ($ret);

function ReservePrice($rp,$it)    {
        $ret = array(true,'');
  if($it == "Auction" || $it =="Dutch Auction")  {
    if(!(is_numeric($rp)) || empty($rp)){
        $ret = array(false, "You have not entered a Valid Reserve Bid.");
    elseif($it == "Fixed Price" || $it =="Classified Ad"){
                        $ret = array(false, "A Reserve Bid cannot be entered for this Type of Listing.");
        return ($ret);

function ItemCategory($element)    {    // Verify Valid Category
  if($element == "000")              //assumes you gave it the value 000
    return array(FALSE, "Please select a Valid Category");
    return array(TRUE);

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.