Hi everybody
I am new to PHP and to this forum. Everybody is extremely helpful here and I am very impressed.
I need your help with sth. I have a form script which works fine. User input the data and what I would like to do is to show the form results in a text area named "formoutput" in the same page and html source of the output in another texarea named "formoutputhtml". The purpose is to let users to copy paste the html code of the output to be able to use on their websites. Here's the link to the finished script;
http://www.freeauctionscripts.com/crosspromotion/
#1 question; How can I set the target of the form to be able to show the results in text area named "formoutput" ?
#2 question; I am totally lost about converting the form output to it's plain text html source. This is the only function I know so far to show the html soucr.
$formoutputhtm = str_replace("<","&lt;",$formoutput);
Maybe it's not necessary but this is the PHP part of the form script I wrote (too long to add form/html part) and I am putting it here, sorry about the mess of the script I have been learning PHP for a week and at least it works 🙂 but please correct my script if I did sth wrong. I use <?php echo $PHP_SELF?> for form's action.
Thanks in advance for all your help.

<html>
<head>
<title>Ebay Auctions Cross Promotion Tool</title>
<link href="/style.css" rel="stylesheet" type="text/css">
<script language=JavaScript src="picker.js"></script>
<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>
</head>
<body>
<?php include "../menu.inc"?>
<?php
// if submit pressed, then start processing form
if ($submit) {

// set variables from form input 
    $twidth = $_POST['twidth']; 
    $theight = $_POST['theight']; 
	$target = $_POST['target']; 
	$rows = $_POST['rows'];
	$border = $_POST['border'];
	$thumbborder = $_POST['thumbborder'];
	$font = $_POST['font'];
	$fontsize = $_POST['fontsize'];
	$fontcolor = $_POST['fontcolor'];
	$title = $_POST['title'];
	$font2 = $_POST['font2'];
	$fontsize2 = $_POST['fontsize2'];
	$fontcolor2 = $_POST['fontcolor2'];
	$footer = $_POST['footer'];
	$storeurl = $_POST['storeurl'];
	$f[0] = $_POST['f1'];
	$f[1] = $_POST['f2']; 
	$f[2]= $_POST['f3'];
	$f[3]= $_POST['f4'];
	$f[4]= $_POST['f5'];
	$f[5]= $_POST['f6'];
	$f[6]= $_POST['f7'];
	$f[7]= $_POST['f8'];
	$f[8]= $_POST['f9'];
	$f[9]= $_POST['f10'];
	$imglink = "http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=";
	$imgsrc = "http://thumbs.ebay.com/pict/";
	$storeurl = $_POST['storeurl'];
	$jpg=".jpg";
//set counter to zero	

if  ($title !="") 
{
echo "<table align=\"center\"><tr><td><font color=\"$fontcolor\" size=\"$fontsize\" face=\"$font\"><center>$title</center></font></td></tr></table>";	
}
//Start creating table
echo "<table border=\"$border\" align=\"center\">";

echo "<tr>";

$c = 0; 
//Start do while
do
{

$totalauctions = $c + 1;
$result = $totalauctions % $rows;
//Start if/break to check empty fields. If input field is empty,then jump out of do/while.
if  ($f[$c] =="") 
{
break;
}//End if/break

if ($totalauctions <= $rows) {
echo "<td width=\"$twidth\" height=\"theight\"><a href=\"$imglink$f[$c]\" target=\"$target\"><img src=\"$imgsrc$f[$c].jpg\" width=\"$twidth\" height=\"$theight\" border=\"$thumbborder\"></a></td>";

}
elseif ($result != 1) {
echo "<td width=\"$twidth\" height=\"theight\"><a href=\"$imglink$f[$c]\" target=\"$target\"><img src=\"$imgsrc$f[$c].jpg\" width=\"$twidth\" height=\"$theight\" border=\"$thumbborder\"></a></td>";
} 
else {
echo "<tr>";

//Create column
echo "<td width=\"$twidth\" height=\"theight\"><a href=\"$imglink$f[$c]\" target=\"$target\"><img src=\"$imgsrc$f[$c].jpg\" width=\"$twidth\" height=\"$theight\" border=\"$thumbborder\"></a></td>";

//End row


}

$c = $c + 1;
}
while ( $c <= 10 ) ;


//Checks 10 times within do while loop
echo "</table>"; 
	if  ($footer !="") 
	{
echo "<table align=\"center\"><tr><td><font color=\"$fontcolor2\" size=\"$fontsize2\" face=\"$font2\"><center>$footer</center></font></td></tr></table>";
}
//Check if Store URL entered
	if  ($storeurl =="") 
	echo "";
	else{
echo "<table align=\"center\"><tr><td><font color=\"$fontcolor2\" size=\"$fontsize2\" face=\"$font2\"><center>Please also visit our <a href=\"$storeurl\" target=\"$target\">Ebay Store</a> </center></font></td></tr></table>";
}
}
else {
?>

//form html is here including two text areas named formoutput & formoutputhtml
</body>
</html>

    I am totally lost here, does anybody have any hints at least about how to work on this question?
    Thanks in advance
    Matt

      Write a Reply...