mylifestyle
New Member
- Messages
- 117
- Reaction score
- 0
- Points
- 0
Hi.
I am currently building a classified ad site and when the 'Description' is entered into the
'textarea' there are no line breaks or paragraphs showing.
ie: looks like :-
xxxx xxxx xxxx xxxx xxxx xxxx xxxx
xxxx xxxx xxxx xxxx xxxx xxxx xxxx
xxxx xxxx xxxx xxxx xxxx xxxx xxxx
I'd like to be able to have the members text read the same as they are inserting which includes line breaks and paragraps as they type them......
xxxx xxxx
xxxx xxxx xxxx xxxx xxxx xxxx xxxx
xxxx xxxx xxxx
xxxxx
xxxx
xxxxxxxxxxx
Does this make sense ?????
The code is below if you can help and I've highlighted the text area...
<?
if ($thisprimecat == "error") {
header("Location: placead.php");
}
else {
$thisprimecat = $_POST["thisprimecat"];
}
include("header.php");
include("linkfunctions.php");
if ( $_POST['B2'] ){
if ( !$_POST['ad_name'] )
$error[] = "You must enter your name!";
if ( !$_POST['ad_email'] )
$error[] = "You must enter an email address!";
elseif ( !preg_match("/^^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]+$$/i", $_POST['ad_email']) )
$error[] = "Invalid email address!";
if ( $_POST['thissubcat'] == "error")
$error[] = "Please select Sub Category!";
if ( !$_POST['ad_item'] )
$error[] = "You must enter your Item!";
if ( !trim($_POST['ad_price']) )
$error[] = "You must enter your Price or type 'FREE' or 'NA'!";
if ( !$_POST['ad_info'] )
$error[] = "You must describe your item!";
$thisprimecat = $_POST["thisprimecat"];
include("database.php");
//--------------------
if ( count($error) == 0 ){
$ad_price = ltrim($_POST['ad_price'], '$');
$ad_ticket = rand(10000,99999999);
if (!mysql_query("INSERT INTO site_ads VALUES (NULL, '".$ad_ticket."', '".$_POST['thisprimecat']."', '".$_POST['thissubcat']."', '".$_POST['ad_name']."', '".$_POST['ad_email']."', '".$_POST['ad_item']."', '".$ad_price."', '".$_POST['ad_info']."', '', 'n', 'n', 'n', NOW())") )
die("Error inserting data into database: ".mysql_error());
$ad_name = $_POST['ad_name'];
$ad_email = $_POST['ad_email'];
showpage($ad_ticket,$ad_name,$ad_email); die();
}//End if (count($error) == 0 ) - from validating email address and password
}
?>
<!-- header ends and body begins-->
<div align="left">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#C0C0C0" width="801" background="images/backgrd.jpg">
<tr>
<td width="184" valign="top">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100">
<tr>
<td><font size="1"> </font></td>
</tr>
</table>
</center>
</div>
<div align="right">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="159">
<?
GetPrimeCat($thislink);
?>
<tr>
<td width="159" class="primelink"> </td>
</tr>
<tr>
<td width="159" class="primelink" align="center">
<?
include("common/adpanel3.php");
?>
</td>
</tr>
<tr>
<td width="159" class="primelink"> </td>
</tr>
</table>
</div>
<p> </p>
</td>
<td width="617" valign="top">
<?
include("selectfunctions.php");
?>
<!-- main body begins here -->
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="458" height="117">
<tr>
<td width="458" height="24" class="adtitle"> </td>
</tr>
<tr>
<td width="458" height="29" class="adtitle" valign="top"><img border="0" src="images/mpoint.gif" align="absmiddle"> Place an Ad <img border="0" src="images/bpoint.gif" align="absmiddle"> Step Two</td>
</tr>
<tr>
<td width="458" height="19">
<form method="POST" action="steptwo.php">
<div align="left">
<table border="0" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111" width="380">
<tr>
<td width="143" align="right" class="primelink"></td>
<td width="257" class="booboo">
<?php if ( count($error) > 0 ){
$msg = join("<br>", $error);
print "$msg";
}
?>
</td>
</tr>
<tr>
<td width="143" align="right" class="primelink">Name:</td>
<td width="257">
<input type="text" name="ad_name" size="50" value="<?=$_POST['ad_name'];?>" style="font-size: 9pt; color: #000080"></td>
</tr>
<tr>
<td width="123" align="right" class="primelink">Email:</td>
<td width="257"><input type="text" name="ad_email" size="50" value="<?=$_POST['ad_email'];?>" style="font-size: 9pt; color: #000080"></td>
</tr>
<tr>
<td width="123" align="right" class="primelink">Item:</td>
<td width="257"><input type="text" name="ad_item" size="50" value="<?=$_POST['ad_item'];?>" style="font-size: 9pt; color: #000080"></td>
</tr>
<tr>
<td width="123" align="right" class="primelink">Sub-Cat:</td>
<td width="257"><select size="1" name="thissubcat" style="font-size: 9pt; color: #000080">
<option selected value="error">Select One</option>
<?
SelectSubCat($thisprimecat);
?>
</select></td>
</tr>
<tr>
<td width="123" align="right" class="primelink">Value £ :</td>
<td width="257"><input type="text" name="ad_price" size="30" value="<?=trim($_POST['ad_price']);?>" style="font-size: 9pt; color: #000080"></td>
</tr>
<tr>
<td width="123" align="right" class="primelink" valign="top">About
Item:</td>
<td width="257"><textarea rows="10" name="ad_info" cols="36" style="font-size: 8pt; color: #000080"><?=$_POST['ad_info'];?></textarea>
<input type="hidden" name="thisprimecat" value="<?=$_POST['thisprimecat'];?>"></td>
</tr>
</table>
</center>
</div>
<? if ( $_POST['B2'] ) {$BACK ="2";} else {$BACK ="1";} ?>
<p align="center"><input type="submit" value="Submit" name="B2"> <input type="reset" value="Reset" name="B3"> <input type="button" value="Start Over" onClick="history.go(-<? echo $BACK ?>)"></p><u><center><font color="000099">You Will Be Able To Add A Picture On The Next Page</u></center></font>
</form>
</td>
</tr>
<tr>
<td width="458" height="19"><? include("common/adpanel1.php"); ?></td>
</tr>
<tr>
<td width="458" height="19"></td>
</tr>
</table>
</center>
</div>
<!-- main body ends here -->
</td>
</tr>
</table>
</div>
<!-- main body ends and footer begins -->
<?
include("footer.php");
function showpage($ad_ticket,$ad_name,$ad_email) {
include("admin.php");
// send confirmation email
$subject = "Please Confirm Your Classified Ad";
$body = "$ad_name,\n\nPlease Confirm Your Classified Ad for Ad ID: '$ad_ticket' by clicking in the link below.\n$webpath/confirm.php?ad_ticket=$ad_ticket\n\nPlease keep your Ad Code '$ad_ticket' handy. You will need it to modify your Classified Ad.\n\n Thank You,\n\n$admin_name\n$admin_email";
$headers = "From: $admin_email";
mail($ad_email,$subject,$body,$headers);
?>
<!-- header ends and body begins-->
<div align="left">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#C0C0C0" width="801" background="images/backgrd.jpg">
<tr>
<td width="184" valign="top">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100">
<tr>
<td><font size="1"> </font></td>
</tr>
</table>
</center>
</div>
<div align="right">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="159">
<?
GetPrimeCat($thislink);
?>
<tr>
<td width="159" class="primelink"> </td>
</tr>
<tr>
<td width="159" class="primelink" align="center">
<?
include("common/adpanel3.php");
?>
</td>
</tr>
<tr>
<td width="159" class="primelink"> </td>
</tr>
</table>
</div>
<p> </p>
</td>
<td width="617" valign="top">
<!-- main body begins here -->
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="387">
<tr>
<td width="387"> </td>
</tr>
<tr>
<td class="primelink" width="387"> </td>
</tr>
<tr>
<td width="387" class="primelink">
<p align="center">Your Classified Ad has been received. Your Ad Code is <b><? echo $ad_ticket ?></b>. Be sure to keep this number handy. You will not be able to modify your Classified Ad in the future.</td>
</tr>
<tr>
<td width="387"> </td>
</tr>
<tr>
<td width="387" class="sublink">
<p align="center">Would you like to upload an image? <a class="sublinkalpha" href="uploadimage.php?ad_ticket=<? echo $ad_ticket ?>">Yes?</a> <a class="sublinkalpha" href="index.php">No?</a></td>
</tr>
</table>
</center>
</div>
<!-- main body ends here -->
</td>
</tr>
</table>
</div>
<!-- main body ends and footer begins -->
<?
include("footer.php");
}
?>
I am currently building a classified ad site and when the 'Description' is entered into the
'textarea' there are no line breaks or paragraphs showing.
ie: looks like :-
xxxx xxxx xxxx xxxx xxxx xxxx xxxx
xxxx xxxx xxxx xxxx xxxx xxxx xxxx
xxxx xxxx xxxx xxxx xxxx xxxx xxxx
I'd like to be able to have the members text read the same as they are inserting which includes line breaks and paragraps as they type them......
xxxx xxxx
xxxx xxxx xxxx xxxx xxxx xxxx xxxx
xxxx xxxx xxxx
xxxxx
xxxx
xxxxxxxxxxx
Does this make sense ?????
The code is below if you can help and I've highlighted the text area...
<?
if ($thisprimecat == "error") {
header("Location: placead.php");
}
else {
$thisprimecat = $_POST["thisprimecat"];
}
include("header.php");
include("linkfunctions.php");
if ( $_POST['B2'] ){
if ( !$_POST['ad_name'] )
$error[] = "You must enter your name!";
if ( !$_POST['ad_email'] )
$error[] = "You must enter an email address!";
elseif ( !preg_match("/^^([a-z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]+$$/i", $_POST['ad_email']) )
$error[] = "Invalid email address!";
if ( $_POST['thissubcat'] == "error")
$error[] = "Please select Sub Category!";
if ( !$_POST['ad_item'] )
$error[] = "You must enter your Item!";
if ( !trim($_POST['ad_price']) )
$error[] = "You must enter your Price or type 'FREE' or 'NA'!";
if ( !$_POST['ad_info'] )
$error[] = "You must describe your item!";
$thisprimecat = $_POST["thisprimecat"];
include("database.php");
//--------------------
if ( count($error) == 0 ){
$ad_price = ltrim($_POST['ad_price'], '$');
$ad_ticket = rand(10000,99999999);
if (!mysql_query("INSERT INTO site_ads VALUES (NULL, '".$ad_ticket."', '".$_POST['thisprimecat']."', '".$_POST['thissubcat']."', '".$_POST['ad_name']."', '".$_POST['ad_email']."', '".$_POST['ad_item']."', '".$ad_price."', '".$_POST['ad_info']."', '', 'n', 'n', 'n', NOW())") )
die("Error inserting data into database: ".mysql_error());
$ad_name = $_POST['ad_name'];
$ad_email = $_POST['ad_email'];
showpage($ad_ticket,$ad_name,$ad_email); die();
}//End if (count($error) == 0 ) - from validating email address and password
}
?>
<!-- header ends and body begins-->
<div align="left">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#C0C0C0" width="801" background="images/backgrd.jpg">
<tr>
<td width="184" valign="top">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100">
<tr>
<td><font size="1"> </font></td>
</tr>
</table>
</center>
</div>
<div align="right">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="159">
<?
GetPrimeCat($thislink);
?>
<tr>
<td width="159" class="primelink"> </td>
</tr>
<tr>
<td width="159" class="primelink" align="center">
<?
include("common/adpanel3.php");
?>
</td>
</tr>
<tr>
<td width="159" class="primelink"> </td>
</tr>
</table>
</div>
<p> </p>
</td>
<td width="617" valign="top">
<?
include("selectfunctions.php");
?>
<!-- main body begins here -->
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="458" height="117">
<tr>
<td width="458" height="24" class="adtitle"> </td>
</tr>
<tr>
<td width="458" height="29" class="adtitle" valign="top"><img border="0" src="images/mpoint.gif" align="absmiddle"> Place an Ad <img border="0" src="images/bpoint.gif" align="absmiddle"> Step Two</td>
</tr>
<tr>
<td width="458" height="19">
<form method="POST" action="steptwo.php">
<div align="left">
<table border="0" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111" width="380">
<tr>
<td width="143" align="right" class="primelink"></td>
<td width="257" class="booboo">
<?php if ( count($error) > 0 ){
$msg = join("<br>", $error);
print "$msg";
}
?>
</td>
</tr>
<tr>
<td width="143" align="right" class="primelink">Name:</td>
<td width="257">
<input type="text" name="ad_name" size="50" value="<?=$_POST['ad_name'];?>" style="font-size: 9pt; color: #000080"></td>
</tr>
<tr>
<td width="123" align="right" class="primelink">Email:</td>
<td width="257"><input type="text" name="ad_email" size="50" value="<?=$_POST['ad_email'];?>" style="font-size: 9pt; color: #000080"></td>
</tr>
<tr>
<td width="123" align="right" class="primelink">Item:</td>
<td width="257"><input type="text" name="ad_item" size="50" value="<?=$_POST['ad_item'];?>" style="font-size: 9pt; color: #000080"></td>
</tr>
<tr>
<td width="123" align="right" class="primelink">Sub-Cat:</td>
<td width="257"><select size="1" name="thissubcat" style="font-size: 9pt; color: #000080">
<option selected value="error">Select One</option>
<?
SelectSubCat($thisprimecat);
?>
</select></td>
</tr>
<tr>
<td width="123" align="right" class="primelink">Value £ :</td>
<td width="257"><input type="text" name="ad_price" size="30" value="<?=trim($_POST['ad_price']);?>" style="font-size: 9pt; color: #000080"></td>
</tr>
<tr>
<td width="123" align="right" class="primelink" valign="top">About
Item:</td>
<td width="257"><textarea rows="10" name="ad_info" cols="36" style="font-size: 8pt; color: #000080"><?=$_POST['ad_info'];?></textarea>
<input type="hidden" name="thisprimecat" value="<?=$_POST['thisprimecat'];?>"></td>
</tr>
</table>
</center>
</div>
<? if ( $_POST['B2'] ) {$BACK ="2";} else {$BACK ="1";} ?>
<p align="center"><input type="submit" value="Submit" name="B2"> <input type="reset" value="Reset" name="B3"> <input type="button" value="Start Over" onClick="history.go(-<? echo $BACK ?>)"></p><u><center><font color="000099">You Will Be Able To Add A Picture On The Next Page</u></center></font>
</form>
</td>
</tr>
<tr>
<td width="458" height="19"><? include("common/adpanel1.php"); ?></td>
</tr>
<tr>
<td width="458" height="19"></td>
</tr>
</table>
</center>
</div>
<!-- main body ends here -->
</td>
</tr>
</table>
</div>
<!-- main body ends and footer begins -->
<?
include("footer.php");
function showpage($ad_ticket,$ad_name,$ad_email) {
include("admin.php");
// send confirmation email
$subject = "Please Confirm Your Classified Ad";
$body = "$ad_name,\n\nPlease Confirm Your Classified Ad for Ad ID: '$ad_ticket' by clicking in the link below.\n$webpath/confirm.php?ad_ticket=$ad_ticket\n\nPlease keep your Ad Code '$ad_ticket' handy. You will need it to modify your Classified Ad.\n\n Thank You,\n\n$admin_name\n$admin_email";
$headers = "From: $admin_email";
mail($ad_email,$subject,$body,$headers);
?>
<!-- header ends and body begins-->
<div align="left">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#C0C0C0" width="801" background="images/backgrd.jpg">
<tr>
<td width="184" valign="top">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100">
<tr>
<td><font size="1"> </font></td>
</tr>
</table>
</center>
</div>
<div align="right">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="159">
<?
GetPrimeCat($thislink);
?>
<tr>
<td width="159" class="primelink"> </td>
</tr>
<tr>
<td width="159" class="primelink" align="center">
<?
include("common/adpanel3.php");
?>
</td>
</tr>
<tr>
<td width="159" class="primelink"> </td>
</tr>
</table>
</div>
<p> </p>
</td>
<td width="617" valign="top">
<!-- main body begins here -->
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="387">
<tr>
<td width="387"> </td>
</tr>
<tr>
<td class="primelink" width="387"> </td>
</tr>
<tr>
<td width="387" class="primelink">
<p align="center">Your Classified Ad has been received. Your Ad Code is <b><? echo $ad_ticket ?></b>. Be sure to keep this number handy. You will not be able to modify your Classified Ad in the future.</td>
</tr>
<tr>
<td width="387"> </td>
</tr>
<tr>
<td width="387" class="sublink">
<p align="center">Would you like to upload an image? <a class="sublinkalpha" href="uploadimage.php?ad_ticket=<? echo $ad_ticket ?>">Yes?</a> <a class="sublinkalpha" href="index.php">No?</a></td>
</tr>
</table>
</center>
</div>
<!-- main body ends here -->
</td>
</tr>
</table>
</div>
<!-- main body ends and footer begins -->
<?
include("footer.php");
}
?>