Jump to content

Nothing Submitting


dean7

Recommended Posts

Hey all, I'm coding a auction page for my website which allows users to bid on certain items without leaving the page, but what I'm getting is when you put your amount in then press the submit putting it returns nothing, this is what I have:

 

This shows the auctions to bid on

echo '<tr>
 <td width="20%" bgcolor="#707070 ">'.htmlspecialchars($Market->carforsale).'</td>
 <td width="10%" bgcolor="#707070"><a href="Market.php?viewcar='.htmlspecialchars($Market->carid).'" target="mainFrame">View Car Stats</a></td>
 <td width="15%" bgcolor="#707070">£'.htmlspecialchars(number_format($Market->price)).'</td>
 <td width="15%" bgcolor="#707070"><a href="profile.php?view='.htmlspecialchars($TheBidderIs).'" target="mainFrame">'.htmlspecialchars($TheBidderIs).'</a></td>
 <td align="center" width="15%" bgcolor="#707070">£<input name="MakeBid" type="text" id="MakeBid" value="'.htmlspecialchars($price).'" class="textinput"><input name="BidCar" type="submit" id="BidCar" class="button" value="Make Bid"></td>
 <td width="15%" bgcolor="#707070">'.htmlspecialchars(MakeTimeLeft($Market->timeleft)).'</td>
 <td width="10%" bgcolor="#707070">'.$RemoveButton.'<input type="hidden" name="theid" value="'.htmlspecialchars($Market->id).'"></td>
 </tr>';

This is the code to submit the bid. (Not actually tested as come across the issue with submitting)

if (strip_tags($_POST['BidCar']) && strip_tags($_POST['MakeBid'])){

 

$MakeBid = strip_tags(htmlspecialchars(trim($_POST['MakeBid'])));

 

if ($Market->seller == $Username){

 

echo "<br /><table class='tableborder' width='20%' cellpadding='1' cellspacing='0' border='1' align='center'>

<tr>

<td class='error_header' align='center'>Error</td>

</tr>

<tr>

<td align='center'>You cannot bid on your own Auctions!</td>

</tr>

</table>

<br />";

 

}elseif (strlen($MakeBid < 100)){

 

echo "<br /><table class='tableborder' width='20%' cellpadding='1' cellspacing='0' border='1' align='center'>

<tr>

<td class='error_header' align='center'>Error</td>

</tr>

<tr>

<td align='center'>Your bid must be £100 or more!</td>

</tr>

</table>

<br />";

 

}elseif($MakeBid < $Market->price){

 

echo "<br /><table class='tableborder' width='20%' cellpadding='1' cellspacing='0' border='1' align='center'>

<tr>

<td class='error_header' align='center'>Error</td>

</tr>

<tr>

<td align='center'>Your bid must be more than ".htmlspecialchars(number_format($Market->price))."!</td>

</tr>

</table>

<br />";

 

}elseif($MakeBid > $UsersTable1->money){

 

echo "<br /><table class='tableborder' width='20%' cellpadding='1' cellspacing='0' border='1' align='center'>

<tr>

<td class='error_header' align='center'>Error</td>

</tr>

<tr>

<td align='center'>You don't have enough money to bid!</td>

</tr>

</table>

<br />";

 

}else{

 

// Update Bidded - Give money back to outbidder if is a outbidder - Send message to Outbidder

 

$BidderMoney = $UsersTable1->money;

$NewMoneyBidder = $BidderMoney - $MakeBid;

 

$BidderNewMoney = $db->prepare("UPDATE `UsersRegTable` SET money = :money WHERE username = :username");

$BidderNewMoney->bindValue(':money', $NewMoneyBidder);

$BidderNewMoney->bindValue(':username', $Username);

$BidderNewMoney->execute();

 

$UpdateBidMarket = $db->prepare("UPDATE `market` SET bidder = :bidder, price = :price WHERE id = :marketid");

$UpdateBidMarket->bindValue(':bidder', $Username);

$UpdateBidMarket->bindValue(':price', $MakeBid);

$UpdateBidMarket->bindValue(':marketid', $Market->id);

$UpdateBidMarket->execute();

 

echo "<br /><table class='tableborder' width='20%' cellpadding='1' cellspacing='0' border='1' align='center'>

<tr>

<td class='header' align='center'>Success</td>

</tr>

<tr>

<td align='center'>You have successfully bidded for that car!</td>

</tr>

</table>

<br />";

I'm not sure why its not subbmitting any data? its also not giving me any errors saying why in my code and nothing in the error log.

 

Thank you for any help given

Link to comment
Share on other sites

are your form fields within a valid post method <form></form>?

 

is your html valid? if it's not, the form fields could be broken and not be considered by the browser to be form fields.

 

what exact post data is being submitted?

 

do you have php's error_reporting set to E_ALL and display_errors set to ON (in the php.ini on your development system) so that php would help you by reporting and displaying all the errors it detects?

 

is the posted code the complete file? it's missing at least two closing } that would producing a php syntax error.

 

lastly, in addition to the questionable statements and logic being used, to provide an audit-trail for the transactions, which also helps in debugging program operation, you should not just add/subtract amounts in a database table field. you should store each plus or minus transaction as a row in a table. to get the current total, you would just SUM() up the values for any user.

Link to comment
Share on other sites

are your form fields within a valid post method <form></form>?

 

is your html valid? if it's not, the form fields could be broken and not be considered by the browser to be form fields.

 

what exact post data is being submitted?

 

do you have php's error_reporting set to E_ALL and display_errors set to ON (in the php.ini on your development system) so that php would help you by reporting and displaying all the errors it detects?

 

is the posted code the complete file? it's missing at least two closing } that would producing a php syntax error.

 

lastly, in addition to the questionable statements and logic being used, to provide an audit-trail for the transactions, which also helps in debugging program operation, you should not just add/subtract amounts in a database table field. you should store each plus or minus transaction as a row in a table. to get the current total, you would just SUM() up the values for any user.

 

Yeah I have the <form></form> tags around the table just not shown in that piece of code, and no its not the full lot its just the bidding side of things piece of code as the rest works to how I like it. It should be submitting the value of whats in the text box but when clicking it just flashes my page and does nothing

Link to comment
Share on other sites

since you didn't address each of the points/questions i ask, it's not going to be possible to directly help you, since we only see the information that you post.

 

these are some more points, from your last thread -

 

are you sure the elseif() statement being shown is true and that no prior related if() or elseif() statement was true so that the shown elseif() will even be executed?

 

is there a header() redirect later in the code that could be redirecting back to the same page, combined with php's output_buffering being on, that would hide any php errors or any output from echo statements in your code?

 

i'm betting your posted code is either not being executed due to conditional statement(s) around it being false or it is being executed and is producing output, but you are not seeing it due to this combination of coding and php's stupid output buffering setting.

 

if you want exact and direct help with what your code is doing, you will need to post all of it, so that we aren't guessing about what it may be doing.

Edited by mac_gyver
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.