...

View Full Version : Form



Noumenon
10-18-2004, 12:23 AM
How can I make this:


<HTML>
<HEAD>
<TITLE>CLAYMEN</TITLE>
<LINK REL="stylesheet" HREF="../style.css" TYPE="text/css">
<BASE TARGET="_self">
<?php include "../scripts/setemo.php" ?>
</HEAD>
<BODY>
<TABLE HEIGHT="100%" WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD ALIGN="center" VALIGN="top">
<IFRAME SRC="interactive_gb.php" WIDTH="300" HEIGHT="310" FRAMEBORDER="0" SCROLLING="yes" STYLE="border-top:1px solid #999999;border-bottom:1px solid #999999;">
</IFRAME>
</TD>
<TD ALIGN="right" VALIGN="top">
<FORM ACTION="interactive_gb.php" METHOD="post" NAME="gb">
<INPUT TYPE="text" NAME="uname" SIZE="22" MAXLENGTH="30" VALUE="&nbsp;Name" CLASS="formstyle" OnFocus="javascript:this.select()"><BR>
<INPUT TYPE="text" NAME="email" SIZE="22" MAXLENGTH="70" VALUE="&nbsp;E-mail" CLASS="formstyle" OnFocus="javascript:this.select()"><BR>
<TEXTAREA NAME="entry" ROWS="7" COLS="19" MAXLENGTH="80" CLASS="formstyle" OnFocus="javascript:this.select()">&nbsp;Message</TEXTAREA><BR>
<SPAN CLASS="formtext">
<INPUT TYPE="submit" NAME="submit" VALUE="&nbsp;Send&nbsp;" CLASS="submitstyle">
<INPUT TYPE="reset" NAME="reset" VALUE="&nbsp;Reset&nbsp;" CLASS="submitstyle">
<BR><BR>
<A HREF="javascript:SetEmo(':)')"><IMG SRC="../pics/emoticons/icon1.gif" BORDER="0"></A>
<A HREF="javascript:SetEmo(':no:')"><IMG SRC="../pics/emoticons/icon2.gif" BORDER="0"></A>
<A HREF="javascript:SetEmo(':yawn:')"><IMG SRC="../pics/emoticons/icon3.gif" BORDER="0"></A>
<A HREF="javascript:SetEmo(':P')"><IMG SRC="../pics/emoticons/icon4.gif" BORDER="0"></A>
<A HREF="javascript:SetEmo(':O')"><IMG SRC="../pics/emoticons/icon5.gif" BORDER="0"></A>
<A HREF="javascript:SetEmo(':D')"><IMG SRC="../pics/emoticons/icon6.gif" BORDER="0"></A>
<A HREF="javascript:SetEmo('>:(</A>')"><IMG SRC="../pics/emoticons/icon7.gif" BORDER="0"></A><BR>
<A HREF="javascript:SetEmo('%)')"><IMG SRC="../pics/emoticons/icon8.gif" BORDER="0"></A>
<A HREF="javascript:SetEmo(':conf:')"><IMG SRC="../pics/emoticons/icon9.gif" BORDER="0"></A>
<A HREF="javascript:SetEmo(':cool:')"><IMG SRC="../pics/emoticons/icon10.gif" BORDER="0"></A>
<A HREF="javascript:SetEmo(';)')"><IMG SRC="../pics/emoticons/icon11.gif" BORDER="0"></A>
<A HREF="javascript:SetEmo(':yes:')"><IMG SRC="../pics/emoticons/icon12.gif" BORDER="0"></A>
<A HREF="javascript:SetEmo(':(')"><IMG SRC="../pics/emoticons/icon13.gif" BORDER="0"></A>
<A HREF="javascript:SetEmo(':|')"><IMG SRC="../pics/emoticons/icon14.gif" BORDER="0"></A>
</SPAN>
</FORM>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>


Post to this:


<HTML>
<HEAD>
<TITLE>CLAYMEN</TITLE>
<LINK REL="stylesheet" HREF="../style.css" TYPE="text/css">
</HEAD>
<BODY>
<TABLE HEIGHT="100%" WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD ALIGN="center" VALIGN="top">
<?php
$host = 'localhost'; // This should be either localhost or 127.0.0.1
$username = 'root'; // Your database username
$password = ''; // Your database password
$dbname = 'guestbook'; // Your database name
$listing = 'DESC'; // Choose how you want your guestbook results to show. ASC = ascending (Older entries at the top of the page), DESC = descending (New entries on the top of the page)
$link = @mysql_connect($host, $username, $password) or die("Unable to connect to the database. Reason: " . mysql_error());
mysql_select_db($dbname, $link) or die("Unable to find database. Reason: " . mysql_error());

if (isset($_POST['submit'])) {
foreach($_POST as $key => $val){
$_POST[$key] = addslashes($val);
}
$email = strlen($_POST['email'] > 0 || $_POST['email'] != '&nbsp;E-mail') ? "'$_POST[email]'" : "NULL";

$sql = "INSERT INTO `entries` SET
`uname` = '$_POST[uname]',
`email` = $email,
`entry` = '".nl2br($_POST['entry'])."',
`dates` = NOW()";

$result = @mysql_query($sql) or die("Error with mysql query on line ".__LINE__.". <BR />".mysql_error());
}

$sql = "SELECT uname,email,entry,dates FROM entries ORDER BY id ".$listing;
$result = @mysql_query($sql) or die("Error with mysql query on line ". __LINE__.".<BR />". mysql_error());

if (@mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
foreach($row as $key => $val){
$row[$key] = htmlentities(trim(stripslashes($val)));
}
echo '<TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="250">'."\n";
echo ' <TR>'."\n";
echo ' <TD HEIGHT="13" ALIGN="left">'."\n";
if (isset($row['email']) != 0) {
echo '<A HREF="mailto:'.$row['email'].'"><B>'.$row['uname'].'</B></A>'."\n";
}
else {
echo '<FONT><B>'.$row['uname'].'</B></FONT>'."\n";
}
echo ' </TD>'."\n";
echo ' <TD HEIGHT="13" ALIGN="right"><FONT>'.$row['dates'].'</FONT></TD>'."\n";
echo ' </TR>'."\n";
echo ' <TR>'."\n";
echo ' <TD ALIGN="left" COLSPAN="2"><DIV ALIGN="justify" WIDTH="250"><FONT>'.$row['entry'].'</FONT></DIV></TD>'."\n";
echo ' </TR>'."\n";
echo ' <TR>'."\n";
echo ' <TD ALIGN="left" COLSPAN="2"><IMG SRC="../pics/999999.gif" HEIGHT="1" WIDTH="250"></TD>'."\n";
echo ' </TR>'."\n";
echo '</TABLE>'."\n";
}
}
else {
echo "<FONT>No entries yet.</FONT>\n";
}
?>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>


Without redirecting the whole page to interactive_gb.php ?
I have this frame where interactive_guestbook.php (the first code in this message) is loaded, and interactive_gb.php is loaded into an iframe.

Cheers
Mattias



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum