Get ready for BLACK FRIDAY shopping starting in

Forums

PHP

This topic is locked

quick questions

Posted 27 Mar 2003 19:16:17
1
has voted
27 Mar 2003 19:16:17 Charles Johnson posted:

Hi, I have a couple of quick questions to ask. The first question is when I insert a record, how do I make it send out an e-mail as well?

The other is how do I make the rows do alternate colors with MX?

Well sorry I have one other question, when I insert a record, my page's won't rediret, I get a message saying headers aleady sent and it tells me the line number. So when I comment the following line of code out

header(sprintf("Location: %s", $insertGoTo));

The error goes away and the page still doesn't redirect.

Thanks for your time.


Replies

Replied 29 Mar 2003 09:33:28
29 Mar 2003 09:33:28 Michael O'Neill replied:
Is that not ASP code?
Replied 31 Mar 2003 09:55:39
31 Mar 2003 09:55:39 Julio Taylor replied:
no, it's PHP code... except that it's far too little for us to know what the problem is!

------------------------
Julio

PHP | MySQL | DWMX | ColdFusion

ICQ: 19735247
Replied 02 Apr 2003 02:38:41
02 Apr 2003 02:38:41 Tim Green replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>header(sprintf("Location: %s", $insertGoTo));<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Well it won't redirect if you comment out the code. ANyway, the problem here is your use of the sprintf command, which (if you read the manual) actually outputs the resultant string to the browser. Because this has happened, the header("Location: ...." element of the line can't work, as out put has been sent to the browser.

The simple solution to your problem is this:-

header("Location: $insertGoTo";

Which will produce the desired result.

As for the rest of your post, it's impossible to give any advice without further information...

All the best

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 06 Apr 2003 04:44:44
06 Apr 2003 04:44:44 Charles Johnson replied:
Hey thanks, you guys, Well here is my code for the alternate row color

//Recordset

if (isset($HTTP_GET_VARS['totalRows_rsTagBoard'])) {
$totalRows_rsTagBoard = $HTTP_GET_VARS['totalRows_rsTagBoard'];
} else {
$all_rsTagBoard = mysql_query($query_rsTagBoard);
$totalRows_rsTagBoard = mysql_num_rows($all_rsTagBoard);
}
$totalPages_rsTagBoard = ceil($totalRows_rsTagBoard/$maxRows_rsTagBoard)-1;

$maxRows_rsUpdates = 2;
$pageNum_rsUpdates = 0;
if (isset($HTTP_GET_VARS['pageNum_rsUpdates'])) {
$pageNum_rsUpdates = $HTTP_GET_VARS['pageNum_rsUpdates'];
}
$startRow_rsUpdates = $pageNum_rsUpdates * $maxRows_rsUpdates;


______________________________

//The Rows


&lt;?php do { ?&gt;
&lt;tr&gt;
&lt;td height="13" colspan="2" class="text"&gt;&lt;a href="&lt;?php echo $row_rsTagBoard['SiteLink']; ?&gt;" target="_blank"&gt;&lt;strong&gt;&lt;?php echo $row_rsTagBoard['TagName']; ?&gt;&lt;/strong&gt;&lt;/a&gt; &nbsp;&lt;strong&gt;&lt;font color="#999999"&gt;&#8224;&lt;/font&gt;&lt;/strong&gt;&nbsp;&lt;?php echo $row_rsTagBoard['Message']; ?&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td height="13" colspan="2"&gt;&lt;hr size="1"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;?php } while ($row_rsTagBoard = mysql_fetch_assoc($rsTagBoard)); ?&gt;

I've created a mini forum for people to post on the site, it's duplicating the TagBoard CGI Script. Thanks again for your help with my other question.




Reply to this topic