Jump to content

Problems with posting a message Can you find any error in this code???


Recommended Posts

Hello all,

My name is Rich and I own and run http://bidoncomics.com

I purchased the php template for the site ( I'm currently learning php ) and I have a problem I cant figure out.

In the auction descriptions the bidder has a choice to post a public message or send it to the seller. Well the send it to seller works fine. But when they choose to post it public the email is sent to the seller that they have a public question but the question is not posted. I have the section of code below. Can anyone spot something I'm missing or is there a file I need to have on my server that maybe I'm missing? The database is set up.

If nothing else what would I have to do to eliminate the public post and only leave the send seller the question part.

Thanks guys for the help. I have actually been reading the boards awhile now getting tips as I learn just never posted.

[code]<!-- Header Ask Seller a Question Section (Public and Private questions) -->

<? header5(strtoupper($lang[askseller]));?>

<? $getPublicMsg = mysql_query("SELECT * FROM probid_public_msg WHERE auctionid='".$_GET['id']."' AND msgtype='Q'") or die(mysql_error());
$isPublicMsg = mysql_num_rows($getPublicMsg);
if ($isPublicMsg>0) { ?>
<table width="100%" border="0" cellspacing="2" cellpadding="2">
<? while ($publicMsg = mysql_fetch_array($getPublicMsg)) { ?>
  <tr class="c3">
     <td width="11" align="center"><img src="themes/<?=$setts['default_theme'];?>/img/system/q.gif"></td>
     <td width="60"><strong><?=$lang[question];?></strong></td>
     <td><?=$publicMsg['content'];?></td>
  </tr><?
$answer = getSqlField("SELECT content FROM probid_public_msg WHERE answerid='".$publicMsg['id']."'","content");
  if ($_SESSION['memberid']!=$auctionDetails['ownerid']) {
  if ($answer!=""&&$answer!="n/a") { ?>
  <tr class="c2">
     <td width="11" align="center"><img src="themes/<?=$setts['default_theme'];?>/img/system/a.gif"></td>
     <td width="60"><strong><?=$lang[answer];?></strong></td>
     <td><?=$answer;?></td>
  </tr><?
  }
} else { ?>
  <form action="auctiondetails.php" method="get">
  <input type="hidden" name="id" value="<?=$_GET['id'];?>">
  <input type="hidden" name="answerid" value="<?=$publicMsg['id'];?>">
  <tr class="c2">
     <td width="11" align="center"> </td>
     <td><strong><?=$lang[answer];?></strong></td>
     <td><textarea name="content" cols="60" rows="2" class="contentfont"><?=$answer;?></textarea>
&nbsp; <input type="submit" value="<?=$lang[answer];?>" name="postanswerok"></td>
  </tr>
  </form>
  <? } ?>
  <tr>
     <td align="center" colspan="3" class="c4"><img src="themes/<?=$setts['default_theme'];?>/img/pixel.gif" width="1" height="1"></td>
  </tr>
  <? } ?>
</table>
<? } ?>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<? if ($_SESSION['membersarea']=="Active"&&$_SESSION['accsusp']!=2) { ?>
<? if ($_SESSION['memberid']==$auctionDetails['ownerid']) { ?>
  <tr class="c2">
     <td align="center"><?=$lang[plsanswerqs];?></td>
  </tr>
<? } else if ($auctionDetails['closed']==1) { ?> 
  <tr class="c2">
     <td align="center"><?=$lang[errorauctclosednoq];?></td>
  </tr>
<? } else { ?> 
<form action="auctiondetails.php" method="get">
  <input type="hidden" name="id" value="<?=$_GET['id'];?>">
  <tr>
     <td>
  <table width="100%" border="0" cellpadding="2" cellspacing="2" align="center" class="border">
<tr class="contentfont" valign="top">
<td class="c2" width="10"><img src="themes/<?=$setts['default_theme'];?>/img/system/i_faq.gif"></td>
  <td class="c2" align="right" width="20%"><strong><?=$lang[askseller];?></strong></td>
  <td class="c3"><textarea name="message" cols="40" rows="3" class="contentfont"></textarea></td>
  <td class="c3" width="80%">
  <div style="padding: 2px;">
  <select name="question_type">
   <? $publicQ = getSqlField("SELECT default_public_questions FROM probid_users WHERE id='".$auctionDetails['ownerid']."'","default_public_questions");
if ($publicQ == "Y"&&$setts['enable_asq']=="Y") { ?><option value="public" selected><?=$lang[postqpublic];?></option><? } ?>
   <option value="private"><?=$lang[postqprivate];?></option>
  </select>
  </div>
  <div style="padding: 2px;">
  <input name="postquestionok" type="submit" id="postquestionok" value="<?=$lang[submit]?>">
  </div>
  </td>
</tr>
   </table>
</td>
  </tr>
</form>
<? } ?>
<? } else { ?>
  <tr class="c2">
     <td align="center" class="contentfont">[ <a href="login.php?auctionid=<?=$_GET['id'];?>"><?=$lang[logintopostqs];?></a> ]</td>
  </tr>
<? } ?>
</table>
<br>
<? }
$mainCat_primary = getMainCat($auctionDetails['category']);
$mainCat_secondary = getMainCat($auctionDetails['addlcategory']);

$getFields = mysql_query("SELECT DISTINCT f.boxid, f.boxname, f.boxtype, d.boxvalue FROM
probid_fields_data d, probid_fields f WHERE d.auctionid='".$_GET['id']."' AND f.active='1' AND d.boxid = f.boxid AND
(f.categoryid='".$mainCat_primary."' OR f.categoryid='".$mainCat_secondary."' OR f.categoryid='0') ORDER BY f.fieldorder ASC") or die(mysql_error());
$isFields = mysql_num_rows($getFields);
if ($isFields) { ?>[/code]
Welcome to the forums... or should I say welcome to posting on these forums!?  ;)

We might need a little more information:

1) What have you done to try and fix it?
2) When you say it's not posted, does it just show a blank area or are you getting an error?
3) Is getSqlField a custom function, and if so, can you post that code?  It may be how that works that is fouling up the rest of your processing.
[quote author=ober link=topic=105184.msg420087#msg420087 date=1156266140]
Welcome to the forums... or should I say welcome to posting on these forums!?  ;)

We might need a little more information:

1) What have you done to try and fix it?

[b]Nothing because since i'm still learning the language I didn't want to screw it up.[/b]

2) When you say it's not posted, does it just show a blank area or are you getting an error?

[b]When the bidder types in his question then hits submit the screen flashes (like if it was sent) then they are right back to the description page. No errors are sent. And the email is sent to the seller letting them know their is a public question waiting to be answered. But when you go to that auction nothing was posted to the description.[/b]

3) Is getSqlField a custom function, and if so, can you post that code?  It may be how that works that is fouling up the rest of your processing.

[b]I will look into this and find out and post the code here.[/b]
[/quote]

Thank you for the help.
[quote author=lessthanthree link=topic=105184.msg420682#msg420682 date=1156342976]
Did you find the code for getSqlField?
[/quote]

No and i have found getSqlNumber  but I'm not sure where I should look. Would it be on the same page? Wow I hate being the noob..lol
I found this in  formchecker.php

[code]## ask seller a question
if (isset($_GET['postquestionok'])) {
$fv=new FormValidator();
$feedback = $_POST['message'];

$fv->isEmpty('message',"$lang[formcheck_askq_empty]");
$fv->isHtml('message',"$lang[formcheck_askq_html]");
if ($fv->isError()) {
$errors = $fv->getErrorList();
echo "<br><blockquote> <p class=\"contentfont\"> \n";
echo "<b>$lang[formcheck_err]</b> \n";
echo "<p class=contentfont> $lang[formcheck_resubmit]: \n";
echo "<ul class=smallfont>";
foreach ($errors as $e) {
echo "<li>" . $e['msg'];

echo "</ul>";
$fv->resetErrorList();
echo "</p></blockquote>";
$action="";
} else {
$action="submit_question";
}
}

## answer public question
if (isset($_GET['postanswerok'])) {
$fv=new FormValidator();
$feedback = $_POST['content'];

$fv->isEmpty('content',"$lang[formcheck_pubans_empty]");
$fv->isHtml('content',"$lang[formcheck_pubans_html]");
if ($fv->isError()) {
$errors = $fv->getErrorList();
echo "<br><blockquote> <p class=\"contentfont\"> \n";
echo "<b>$lang[formcheck_err]</b> \n";
echo "<p class=contentfont> $lang[formcheck_resubmit]: \n";
echo "<ul class=smallfont>";
foreach ($errors as $e) {
echo "<li>" . $e['msg'];

echo "</ul>";
$fv->resetErrorList();
echo "</p></blockquote>";
$action="";
} else {
$action="submit_answer";
}
}
?>[/code]
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.