Jump to content

Archived

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

kenwvs

Won't validate from within itself - RESOLVED

Recommended Posts

I am trying to validate a form, and from what I can understand, this should validate from within itself.  I have a functions.php with all the functions that it calls for.  I have included all the validate codes, including the submit button at the bottom, as well as the first field from the form (form is quite lengthy)

For the life of me, I can't figure out why it won't validate from within itself, it generates a 404 page not found, as I don't have a seperate page called validation.php

thanks for any help you can give me.

Ken

[code]<?php
/* validation.php */

require_once ('functions.php');

$valid = TRUE;

if (isset ($_POST['Submit'])) {
    foreach($_POST as $key=>$value) {
      $$key = $value;
    }

    $valid = $user = LettersAndDigits($id);
    $title = Variable($item_title);
    $valid = $valid && $title;
    $category = Variable($item_category);
    $valid = $valid && $category;
    $type = Variable($item_type);
    $valid = $valid && $type;
    $quantity = isDigits($quantity_available);
    $valid = $valid && $quantity;
    $price = Dollars($starting_bid);
    $valid = $valid && $price;
    $increment = DollarsorEmpty($bid_increment);
    $valid = $valid && $increment;
    $reserve = DollarsorEmpty($reserve_price);
    $valid = $valid && $reserve;
    $length = isDigits($duration);
    $valid = $valid && $length;
    $time = isDigits($end_time);
    $valid =$valid && $time;
    $relist = isLetters($auto_relist);
    $valid = $valid && $relist;
    $ct = Variable($city);
    $valid = $valid && $ct;
    $prov = Variable($state);
    $valid = $valid && $prov;
    $cntry = Variable($country);
    $valid = $valid && $cntry;
    $desc = Variable($item_description);
    $valid = $valid && $desc;
    $pay = EmailorEmpty($paypal_id);
    $valid = $valid && $pay;
    $hit = Variable($hit_counter);
    $valid = $valid && $hit;
      if ($valid) {
        echo "Form filled successfully!";
        exit;
       }
} else {
    $user = $title = $category = $type = $quantity = $price = $increment =
    $reserve = $length =$time = $relist = $ct = $prov = $cntry = $desc = $pay =
    $hit = TRUE;
    $id = $item_title = $item_category = $item_type = $quantity_available =
    $starting_bid = $bid_increment = $reserve_price = $duration = $end_time =
    $auto_relist = $city = $state = $country = $item_description = $paypal_id =
    $hit_counter = '';
}
?>
<body bgcolor="#F5F3F5">
<p align="center"><b><font face="Arial" size="3" 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="center"><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;
<?php
if (!$valid) {
?>
<style type="text/css">
td.error {color:C03; font-weight:bold; }
</style>
Please correct the items in red and resubmit.<br /><br />
<?php
}
?>
<form method="POST" action="validation.php">
<HR>
<tr>
    <td> <font size="2"<?php if(!$user) echo 'class="error"'; ?>> User ID:
    </td></font>
    <td> <font size="2">&nbsp;<font face="Arial"><input type="text" name="id"
         size="12" value="<?= $id ?>"
    </td></font>
    <td> &nbsp;&nbsp;<font size="2">You must use the <B>same User ID</B>
         for all items you are uploading during this session.</font>
         <font size="2">(It does not have to be your regular username.)
    </td><BR><P> </font>
</tr>[/code]

[code]<td><input type="submit" name="Submit" value="SAVE  ITEM">
    </td> <font size="2">[/code]

Share this post


Link to post
Share on other sites
At this time, the form is called uploadformcomplete.php

does the form need to be the same name as the action?

Ken

Share this post


Link to post
Share on other sites
well yes, its looking for validation.php and cant find it. If you change the action to uploadformcomplete.php or the file name to validation.php it should work.

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.