Page 1 of 1

Sending E-mail

Posted: Thu Jun 21, 2007 2:16 pm
by the9ulaire
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I'm still working through my book.  I was out of town for five days and have been extremely busy this week so I haven't had a chance to make it as far as I'd like.  The chapter I'm in is about sending e-mail.  The URL I'm dealing with is: http://lwrussell.com/phptesting/comicsi ... stcard.php

When I open postcard.php it should bring up a nice little form that allows you to send a postcard.  Currently it brings up the send info but not a choice of postcards nor a message body.  Here's my code for postcard.php:

[syntax="html"]<html>
<head>
<title>Enter E-mail Data</title>
</head>
<body>
<form name="theform" method="post" action="sendconf.php">
<center>
<table width="640" border="0" cellpadding="4" cellspacing="0">
	<tr>
		<td colspan="4"><h2>Postcard Sender</h2></td>
	</tr>
	<tr bgcolor="#CCCCCC">
		<td>To:</td>
		<td><input type="text" name="toname" size="30" /></td>
		<td>e-mail:</td>
		<td><input type="text" name="to" size="40" /></td>
	</tr>
	<tr>
		<td>From:</td>
		<td><input type="text" name="fromname" size="30" /></td>
		<td>e-mail:</td>
		<td><input type="text" name="from" size="40" /></td>
	</tr>
	<tr bgcolor="#CCCCCC">
		<td>Cc:</td>
		<td><input type="text" name="cc" size="40" /></td>
		<td>Bcc:</td>
		<td><input type="text" name="bcc" size="40" /></td>
	</tr>
	<tr>
		<td colspan="2">Choose a Postcard:
			<select name="postcard[]" onChange="changepostcard(this.value)">
			<?php
				include("conn_comic.php");
				$sql = "SELECT * FROM images ORDER BY img_desc";
				$images = mysql_query($sql, $conn) or die(mysql_error());
				$iloop = 0;
				while ($imagearray = mysql_fetch_array($images)) {
					$iloop++;
					$iurl = $imagearray['img_url'];
					$idesc = $imagearray['img_desc'];
					if ($iloop == 1) {
						echo "<option selected value=\"$iurl\">$idesc</option>\n";
						$image_url = $imagearray['img_url'];
					} else {
						echo "<option value=\"$iurl\">$idesc</option>\n";
					}
				}
			?>
			</select><br />
		</td>
		<td>Subject:</td>
		<td><input type="text" name="subject" size="40" /></td>
	</tr>
	<tr>
		<td colspan="2"><img src="<?php echo($image_url)?>" width="320"
			height="240" border="0" id="postcard" /></td>
		<td valign="top">&nbsp;</td>
		<td align="right">
			<textarea cols="30" rows="12" name="message">
				Enter your message here</textarea>
			<input type="submit" value="Send" />
			<input type="reset" value="Resent the form" />
		</td>
	</tr>
</table>
</center>
</form>
<script language="javascript">
function changepostcard(imgurl) {
	window.document.theform.postcard.src = imgurl;
}
</script>
</body>
</html>
Seeing as the error occurs immediately after the column "choose a postcard:" in my html, I'm assuming that the issue immediately follows. You'll see it includes "conn_comic.php" which is the connection to the database info. I'm doing it differently than my book does because the book is as if you were working on your own computer environment using Apache, which I've had so many Windows problems lately I resorted to testing on my own server.
The book has: include("./includes/conn_comic.php");
I'll be honest, since I'm new to this a lot of things don't make sense that would seem more like common sense to someone who's done this stuff for a while.

I appreciate help!
Thanks guys!
Luke W Russell


feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Thu Jun 21, 2007 2:54 pm
by superdezign
What's the error message?

Posted: Thu Jun 21, 2007 2:57 pm
by the9ulaire
There is no error message. Take a look at the URL. That's why I'm stuck on what to do next. I have the pictures in my database, but it looks like the PHP just stopped running after a certain point.

Posted: Thu Jun 21, 2007 3:06 pm
by superdezign
http://lwrussell.com/phptesting/comicsite/chapt11/postcard.php wrote:Table 'postcard.images' doesn't exist
If you view source, you'll see it.

Posted: Fri Jun 22, 2007 3:36 pm
by the9ulaire
Thanks. I finally realized my table was titled image. Simple mistake but fatal. Thank you for pointing me in the right direction!

Luke