0

hello all,
i need html table to be inserted in php code..i tried this but i am getting some problem with it so can anyone help me..
Thank u..

$messageproper ="\n\n" .
		"Name: " .
		ucwords($_POST['name']) .
		"\n" .
		"Email: " .
		ucwords($email) .
		"\n" .
		"Message: " .
		$_POST['message'] .
		"\n" .
		"\n\n" ;

i need this Name,Email and Message to be in a table..

3
Contributors
9
Replies
10
Views
6 Years
Discussion Span
Last Post by nonshatter
0

You have no html in that code!...

<?php

  // ---- your code ---- //

?>
<html>
<table>
  <tr>
      <td>name</td>
      <td>email</td>
      <td>message</td>
  </tr>
  <tr>
      <td><?php ucwords($_POST['name']); ?></td>
      <td><?php ucwords($email); ?></td>
      <td><?php $_POST['message']; ?></td>
  </tr>
</table>
</html>

tr creates a new row, td creates a new cell

0

no i dont had any html code init..Once check the code i had posted..Name,Email,Message are assigned to $messageproper.

0

But name message and email are individual variables being assigned to $messageproper. So my code should work.

0

So you want the table with the values in, and then assign them to $messageproper? What are you using messageproper for?

You can do it exactly the same way as you'd done previously. I'm not sure if you still want the line breaks in there or not though.

// table with the values goes here...


//then assign the values to the messageproper variable.
$messageproper ="\n\n" .
		"Name: " .
		ucwords($_POST['name']) .
		"\n" .
		"Email: " .
		ucwords($email) .
		"\n" .
		"Message: " .
		$_POST['message'] .
		"\n" .
		"\n\n" ;

Edited by nonshatter: n/a

0

ok..i am posting my full code here..actually this for sending mail.It is working fine.But the mail appears very ordinary..I need that to be in a table with some background color..

<?
$mailto = "xxx@gmail.com";
$cc = "";
$bcc = "";
$subject = "Mail received";
$vname = $_POST['name'];
$email = $_POST['email'];
function validateEmail($email)
{
   if(eregi('^[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+\.[a-zA-Z]{2,4}(\.[a-zA-Z]{2,3})?(\.[a-zA-Z]{2,3})?$', $email))
	  return true;
   else
	  return false;
}
if((strlen($_POST['name']) < 1 ) || (strlen($email) < 1 ) || (strlen($_POST['message']) < 1 ) || validateEmail($email) == FALSE){
	$emailerror .= 'Error:';

	if(strlen($_POST['name']) < 1 ){
		$emailerror .= '<li>Enter name</li>';
	}

	if(strlen($email) < 1 ){
		$emailerror .= '<li>Enter email</li>';
	}

	if(validateEmail($email) == FALSE) {
		$emailerror .= '<li>Enter valid email</li>';
	}

	if(strlen($_POST['message']) < 1 ){
		$emailerror .= '<li>Enter message</li>';
	}

} else {

	$emailerror .= "<span>Your email has been sent successfully!</span>";



	// NOW SEND THE ENQUIRY

	$timestamp = date("F j, Y, g:ia");

	$messageproper ="\n\n" .
		"Name: " .
		ucwords($_POST['name']) .
		"\n" .
		"Email: " .
		ucwords($email) .
		"\n" .
		"Message: " .
		$_POST['message'] .
		"\n" .
		"\n\n" ;

		$messageproper = trim(stripslashes($messageproper));
		mail($mailto, $subject, $messageproper, "From: \"$vname\" <".$_POST['e_mail'].">\nReply-To: \"".ucwords($_POST['first_name'])."\" <".$_POST['e_mail'].">\nX-Mailer: PHP/" . phpversion() );

}
?>

<div id='emailerror'>
	<ul>
		<? echo $emailerror; ?>
	</ul>
</div>

Edited by niths: n/a

0
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];

$propermessage = "Name:\n ucwords($name)\n Email:\n $email\n Message:\n $message\n\n\n";

when you uses $propermessage variable again us it with the nl2br function

echo nl2br($propermessage);

Edited by terabyte: n/a

0

thanks for ur response...But wat i exactly need is..to put Name,Email,Message in a table..so can we do that..

0
$messageproper = "<table>
                   <tr>
                      <td>name</td>
                      <td>email</td>
                      <td>message</td>
                   </tr>
                   <tr>
                      <td>".ucwords($_POST['name'])."</td>
                      <td>".ucwords($email)."</td>
                      <td>".$_POST['message']."</td>
                   </tr>
                 </table>";

echo $messageproper;

Something like this should work but check the syntax, you might need to play around with the quotes to get it working properly...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.