Help with validating

Hi there, I am trying to get a small page working, where people can bid on an item.
I would like it to go through three stages.

Now I tried it on my computer and it works ok if I try it on my localhost.
I went and ftp’d it to my server and it does not work?
Frustrating indeed.
I am hoping that someone can help me solve this issue.

It seems not to go to the next page. Anyway here is the code at the moment, just the page that does not work.

My thanks in advance.
(modified Please look at it online : www.robertbrasingtonkites.com/auction/index.php)

<?php 
// define variables and set to empty values

$bid = "";

if ($_SERVER["REQUEST_METHOD"] == "POST") {

if (empty($_POST["bid"])) {
     print "Please place your bid";
   } else {
     $bid = ($_POST["bid"]);
   }

$persons_bid = $bid;
$current_bid = $current_bid_nr;

if ($persons_bid < $current_bid) {

print("<p class='error'><span>ERROR</span><br><img src='img/arrow_down.png' /><br>Your bid is lower than the highest bidder, please try again.</p>");

}

else if ($persons_bid == $current_bid) {
print("<p class='error'><span>ERROR</span><br><img src='img/arrow_down.png' /><br>Your bid is equal to the highest bidder, please try again.</p>");

}


else if (! ctype_digit($_POST['bid'])) {

print ("<p class='error'><span>ERROR</span><br><img src='img/arrow_down.png' /><br>Please use numbers only</p>");
}


else if($persons_bid > $current_bid) {

$myfile = fopen("inc/persons_bid_price.php", "w") or die("Unable to open file!");

$make_up_1 = "<" ."?" ."php". " $" ."persons_bid_nr ='";
$make_up_2 ="';?>";


$new_total_bid = $make_up_1 .$persons_bid .$make_up_2;

fwrite($myfile, $new_total_bid);
fclose($myfile);

header("Location:bid_form_step_2.php");
          }
}

echo "</div>";

include ("inc/footer.php");
?>

If you look where the color code stops you will get to at least one problem.

Oh Oh. are there more?
Thanks for your help Kevin I appreciate it. If you know the solution, I would love to find out.

Cheers
Robert

You dont have $current_bid_nr defined anywhere.

This is not the full page, above this code it states to include a file that contains the $current_bid_nr data.

<?php include ("inc/current_highest_bid.kite"): ?>

And that file “current_highest_bid.kite” contains :

<?php  $current_bid_nr = "55"; ?>

When a bid is entered, the data is changed to the new bid if it contains numbers, is higher than and not equal to the $current_bid_nr .

I would then like it to go to the next step where they enter their contact details, they also are entered into a file.

I am doing this for a friend and I am not a pro, this is just something I do as a hobby but it can get very frustrated when you do not know why it works on your computer and not online.

Cheers
Robert

This is why Vagrant is so good. In my experience there are generally two reason why code works one place but not the other: the versions are different; permission issues.

Trying to debug with bits and pieces that you think is all thats needed can be near impossible. If you want the best possible complete answer, post a zip with EVERYTHING required to run it on our end. You will have your correct answer much faster.

If your car is having problems, you dont just take the motor to the shop, you take the whole car.

By the way, this is wrong:

<?php include ("inc/current_highest_bid.kite")[b][size=18pt]:[/size][/b] ?>

never mind, I understand you have no idea how to help me otherwise you would have done so, comparing it with cars gives me an idea about your intelligence.
Ill ask others that can help on forums that do like to help other humans.

BTW, the “:” is not in my code but I just mistyped it in my answer.

Cheers
Robert

No, what you should understand is you have no idea how to ask for help on a coding forum or provide what is needed for someone to help you which is why you dont have an answer to the problem we are trying to help you with for FREE.

This forum has several master level coders, myself included. If you dont have an answer, it’s your fault. The semi-colon typo is a perfect example, since you have not provided ALL the relevant code, there is no way for anyone to know your snippet was just a typo in the post further muddying the debugging waters.

So, are you showing the page that does not redirect or the page you are redirected to?

What kevin is saying, in your terms, “My kite won’t fly. Here is the string.”

Kiwicrafter? Did you not understand Kevin’s first post to you? The solution? Look at your first post and you
will notice where the text looses it’s color. There is a bad error on line #40. Fix that, do not give up until you
solve a problem!

Sponsor our Newsletter | Privacy Policy | Terms of Service