Jump to content

putting HTML script into $message mailer


JohnSabol

Recommended Posts

Hi everyone!

I would like to get into

 

$mailsent     = mail
(
"[email protected]",
"Order: $name",
"$message \n \n \n $name \n $email \n \n \n ", "");

 

a table like this:

<table border="0">
  <tr>
    <td width="30"> </td>
    <td width="120">Foto</td>
    <td width="30">A4</td>
    <td width="30">A3</td>
    <td width="120">other size</td>
  </tr>
</table>

 

It shold be between "$message \n \n \n $name \n $email and \n \n \n ", "");

 

how can i do that? Dreamweaver shows me always an error

Link to comment
https://forums.phpfreaks.com/topic/286867-putting-html-script-into-message-mailer/
Share on other sites

Your question makes little sense. What is the issue?

the issue is, that i want to get mail with filled out table (customer fills table out) and dreamweaver shows me always an syntax error if i do it so:

 

"$message \n \n \n $name \n $email \n

<table border="0">

  <tr>

    <td width="30"> </td>

    <td width="120">Foto</td>

    <td width="30">A4</td>

    <td width="30">A3</td>

    <td width="120">other size</td>

  </tr>

</table>

 

 ", "");

 

i dont do programming so i have NO IDEA how it should be..

ok.. i paste here entire code. maybe you gonna laugh about it but its only way i can do it.

 

index.php

<!doctype html>
<html>
<head>
<meta charset="windows-1250">
<title>John Sabol</title>
<link href="styles/main.css" rel="stylesheet" type="text/css">
<!--The following script tag downloads a font from the Adobe Edge Web Fonts server for use within the web page. We recommend that you do not modify it.--><script>var __adobewebfontsappname__="dreamweaver"</script><script src="http://use.edgefonts.net/source-sans-pro:n2,n6:default.js" type="text/javascript"></script>
</head>

<body>
<form id="EmailForm" action="mailForm.php" method="post" onsubmit="validateForm()">
  <table width="568">
  <tr>
    <td width="280" class="iframe"><label for="Name"> Name:
      <input type="text" value="" name="name" size="30" />
    </label></td>
    <td width="236">
    Mail:
    <input type="text" value="" name="email" size="30" /></td>
  </tr>
</table>
<p class="table">
<table border="0">
  <tr>
    <td width="30"> </td>
    <td width="120">Foto</td>
    <td width="30">A4</td>
    <td width="30">A3</td>
    <td width="120">Custom size</td>
  </tr>
  <tr>
    <td>1.</td>
    <td><input type="text" value="" name="foto01" size="20" /></td>
    <td><input type="text" value="" name="a401" size="5" /></td>
    <td><input type="text" value="" name="a301" size="5" /></td>
    <td><input type="text" value="" name="othersize01" size="20" /></td>
  </tr>
  <tr>
    <td>2.</td>
    <td><input type="text" value="" name="foto02" size="20" /></td>
    <td><input type="text" value="" name="a402" size="5" /></td>
    <td><input type="text" value="" name="a302" size="5" /></td>
    <td><input type="text" value="" name="othersize02" size="20" /></td>
  </tr>
  <tr>
    <td>3.</td>
    <td><input type="text" value="" name="foto03" size="20" /></td>
    <td><input type="text" value="" name="a403" size="5" /></td>
    <td><input type="text" value="" name="a303" size="5" /></td>
    <td><input type="text" value="" name="othersize03" size="20" /></td>
  </tr>
  <tr>
    <td>4.</td>
    <td><input type="text" value="" name="foto04" size="20" /></td>
    <td><input type="text" value="" name="a404" size="5" /></td>
    <td><input type="text" value="" name="a304" size="5" /></td>
    <td><input type="text" value="" name="othersize04" size="20" /></td>
  </tr>
  <tr>
    <td>5.</td>
    <td><input type="text" value="" name="foto05" size="20" /></td>
    <td><input type="text" value="" name="a405" size="5" /></td>
    <td><input type="text" value="" name="a305" size="5" /></td>
    <td><input type="text" value="" name="othersize05" size="20" /></td>
  </tr>
  <tr>
    <td>6.</td>
    <td><input type="text" value="" name="foto06" size="20" /></td>
    <td><input type="text" value="" name="a406" size="5" /></td>
    <td><input type="text" value="" name="a306" size="5" /></td>
    <td><input type="text" value="" name="othersize06" size="20" /></td>
  </tr>
  <tr>
    <td>7.</td>
    <td><input type="text" value="" name="foto07" size="20" /></td>
    <td><input type="text" value="" name="a407" size="5" /></td>
    <td><input type="text" value="" name="a307" size="5" /></td>
    <td><input type="text" value="" name="othersize07" size="20" /></td>
  </tr>
  <tr>
    <td>8.</td>
    <td><input type="text" value="" name="foto08" size="20" /></td>
    <td><input type="text" value="" name="a408" size="5" /></td>
    <td><input type="text" value="" name="a308" size="5" /></td>
    <td><input type="text" value="" name="othersize08" size="20" /></td>
  </tr>
  <tr>
    <td>9.</td>
    <td><input type="text" value="" name="foto09" size="20" /></td>
    <td><input type="text" value="" name="a409" size="5" /></td>
    <td><input type="text" value="" name="a309" size="5" /></td>
    <td><input type="text" value="" name="othersize09" size="20" /></td>
  </tr>
  <tr>
    <td>10.</td>
    <td><input type="text" value="" name="foto10" size="20" /></td>
    <td><input type="text" value="" name="a410" size="5" /></td>
    <td><input type="text" value="" name="a310" size="5" /></td>
    <td><input type="text" value="" name="othersize10" size="20" /></td>
  </tr>
  <tr>
    <td>11.</td>
    <td><input type="text" value="" name="foto11" size="20" /></td>
    <td><input type="text" value="" name="a411" size="5" /></td>
    <td><input type="text" value="" name="a311" size="5" /></td>
    <td><input type="text" value="" name="othersize11" size="20" /></td>
  </tr>
  <tr>
    <td>12.</td>
    <td><input type="text" value="" name="foto12" size="20" /></td>
    <td><input type="text" value="" name="a412" size="5" /></td>
    <td><input type="text" value="" name="a312" size="5" /></td>
    <td><input type="text" value="" name="othersize12" size="20" /></td>
  </tr>
  <tr>
    <td>13.</td>
    <td><input type="text" value="" name="foto13" size="20" /></td>
    <td><input type="text" value="" name="a413" size="5" /></td>
    <td><input type="text" value="" name="a313" size="5" /></td>
    <td><input type="text" value="" name="othersize13" size="20" /></td>
  </tr>
  <tr>
    <td>14.</td>
    <td><input type="text" value="" name="foto14" size="20" /></td>
    <td><input type="text" value="" name="a414" size="5" /></td>
    <td><input type="text" value="" name="a314" size="5" /></td>
    <td><input type="text" value="" name="othersize14" size="20" /></td>
  </tr>
  <tr>
    <td>15.</td>
    <td><input type="text" value="" name="foto15" size="20" /></td>
    <td><input type="text" value="" name="a415" size="5" /></td>
    <td><input type="text" value="" name="a315" size="5" /></td>
    <td><input type="text" value="" name="othersize15" size="20" /></td>
  </tr>
</table>

</p>




<table width="509">
  <tr>
    <td height="38" class="iframe"><label for="Name2">Comment:</label></td>
  </tr>
  <tr>
    <td><textarea name="message" rows="5" cols="60"></textarea></td>
  </tr>
  <tr>
    <td colspan="2" style="text-align:center"><!-- We are grateful to you for keeping this link in place. thank you. -->
      <input type="submit" value="Send"></td>
  </tr>
</table>
</form>
<p> </p>
</body>
</html>


mailform.php
<?php
//table
$foto01        = $_POST['foto01'];
$foto02        = $_POST['foto02'];
$foto03        = $_POST['foto03'];
$foto04        = $_POST['foto04'];
$foto05        = $_POST['foto05'];
$foto06        = $_POST['foto06'];
$foto07        = $_POST['foto07'];
$foto08        = $_POST['foto08'];
$foto09        = $_POST['foto09'];
$foto10        = $_POST['foto10'];
$foto11        = $_POST['foto11'];
$foto12        = $_POST['foto12'];
$foto13        = $_POST['foto13'];
$foto14        = $_POST['foto14'];
$foto15        = $_POST['foto15'];

$a401        = $_POST['a401'];
$a402        = $_POST['a402'];
$a403        = $_POST['a403'];
$a404        = $_POST['a404'];
$a405        = $_POST['a405'];
$a406        = $_POST['a406'];
$a407        = $_POST['a407'];
$a408        = $_POST['a408'];
$a409        = $_POST['a409'];
$a410        = $_POST['a410'];
$a411        = $_POST['a411'];
$a412        = $_POST['a412'];
$a413        = $_POST['a413'];
$a414        = $_POST['a414'];
$a415        = $_POST['a415'];

$a301        = $_POST['a301'];
$a302        = $_POST['a302'];
$a303        = $_POST['a303'];
$a304        = $_POST['a304'];
$a305        = $_POST['a305'];
$a306        = $_POST['a306'];
$a307        = $_POST['a307'];
$a308        = $_POST['a308'];
$a309        = $_POST['a309'];
$a310        = $_POST['a310'];
$a311        = $_POST['a311'];
$a312        = $_POST['a312'];
$a313        = $_POST['a313'];
$a314        = $_POST['a314'];
$a315        = $_POST['a315'];

$othersize01        = $_POST['othersize01'];
$othersize02        = $_POST['othersize02'];
$othersize03        = $_POST['othersize03'];
$othersize04        = $_POST['othersize04'];
$othersize05        = $_POST['othersize05'];
$othersize06        = $_POST['othersize06'];
$othersize07        = $_POST['othersize07'];
$othersize08        = $_POST['othersize08'];
$othersize09        = $_POST['othersize09'];
$othersize10        = $_POST['othersize10'];
$othersize11        = $_POST['othersize11'];
$othersize12        = $_POST['othersize12'];
$othersize13        = $_POST['othersize13'];
$othersize14        = $_POST['othersize14'];
$othersize15        = $_POST['othersize15'];

//mailer
$name         = $_POST['name'];  
$email         = $_POST['email'];
$mailsent     = mail
(
"[email protected]",
"Order: $name",
"$message \n \n \n $name \n $email \n \n \n ", "");

if ($mailsent) {
echo
(" <p class='subcaption'>You sent Mail</p> ");
}
?>

 

ok i made some differences:

 

mailform.php
<?php
//table
$foto    = $_POST['foto'];
$a4     = $_POST['a4'];
$a3     = $_POST['a3'];
$othersize = $_POST['othersize'];

//mailer
$name         = $_POST['name'];  
$email         = $_POST['email'];
$mailsent     = mail
(
"[email protected]",
"Order: $name",
"$message \n \n \n $name \n $email \n \n \n ", "");

if ($mailsent) {
echo
(" <p class='subcaption'>You sent Mail</p> ");
}
?>

 

index.php

<!doctype html>
<html>
<head>
<meta charset="windows-1250">
<title></title>
<link href="styles/main.css" rel="stylesheet" type="text/css">
<!--The following script tag downloads a font from the Adobe Edge Web Fonts server for use within the web page. We recommend that you do not modify it.--><script>var __adobewebfontsappname__="dreamweaver"</script><script src="http://use.edgefonts.net/source-sans-pro:n2,n6:default.js" type="text/javascript"></script>
</head>

<body>
<form id="EmailForm" action="mailForm.php" method="post" onsubmit="validateForm()">
<table width="568">
  <tr>
    <td width="280" class="iframe"><label for="Name"> Name:
      <input type="text" value="" name="name" size="30" />
    </label></td>
    <td width="236">
    Mail:
    <input type="text" value="" name="email" size="30" /></td>
  </tr>
</table>
<p class="table">
<table border="0">
  <tr>
    <td width="30"> </td>
    <td width="120">Foto</td>
    <td width="30">A4</td>
    <td width="30">A3</td>
    <td width="120">Custom size</td>
  </tr>
  <tr>
    <td>1.</td>
    <td><input name="foto[]" size="20"></td>
    <td><input name="a4[]" size="5"></td>
    <td><input name="a3[]" size="5"></td>
    <td><input name="otherside[]" size="20"></td>
  </tr>
  <tr>
    <td>2.</td>
    <td><input name="foto[]" size="20"></td>
    <td><input name="a4[]" size="5"></td>
    <td><input name="a3[]" size="5"></td>
    <td><input name="otherside[]" size="20"></td>
  </tr>
  <tr>
    <td>3.</td>
    <td><input name="foto[]" size="20"></td>
    <td><input name="a4[]" size="5"></td>
    <td><input name="a3[]" size="5"></td>
    <td><input name="otherside[]" size="20"></td>
  </tr>
  <tr>
    <td>4.</td>
    <td><input name="foto[]" size="20"></td>
    <td><input name="a4[]" size="5"></td>
    <td><input name="a3[]" size="5"></td>
    <td><input name="otherside[]" size="20"></td>
  </tr>
  <tr>
    <td>5.</td>
    <td><input name="foto[]" size="20"></td>
    <td><input name="a4[]" size="5"></td>
    <td><input name="a3[]" size="5"></td>
    <td><input name="otherside[]" size="20"></td>
  </tr>
  <tr>
    <td>6.</td>
    <td><input name="foto[]" size="20"></td>
    <td><input name="a4[]" size="5"></td>
    <td><input name="a3[]" size="5"></td>
    <td><input name="otherside[]" size="20"></td>
  </tr>
  <tr>
    <td>7.</td>
    <td><input name="foto[]" size="20"></td>
    <td><input name="a4[]" size="5"></td>
    <td><input name="a3[]" size="5"></td>
    <td><input name="otherside[]" size="20"></td>
  </tr>
  <tr>
    <td>8.</td>
    <td><input name="foto[]" size="20"></td>
    <td><input name="a4[]" size="5"></td>
    <td><input name="a3[]" size="5"></td>
    <td><input name="otherside[]" size="20"></td>
  </tr>
  <tr>
    <td>9.</td>
    <td><input name="foto[]" size="20"></td>
    <td><input name="a4[]" size="5"></td>
    <td><input name="a3[]" size="5"></td>
    <td><input name="otherside[]" size="20"></td>
  </tr>
  <tr>
    <td>10.</td>
    <td><input name="foto[]" size="20"></td>
    <td><input name="a4[]" size="5"></td>
    <td><input name="a3[]" size="5"></td>
    <td><input name="otherside[]" size="20"></td>
  </tr>
  <tr>
    <td>11.</td>
    <td><input name="foto[]" size="20"></td>
    <td><input name="a4[]" size="5"></td>
    <td><input name="a3[]" size="5"></td>
    <td><input name="otherside[]" size="20"></td>
  </tr>
  <tr>
    <td>12.</td>
    <td><input name="foto[]" size="20"></td>
    <td><input name="a4[]" size="5"></td>
    <td><input name="a3[]" size="5"></td>
    <td><input name="otherside[]" size="20"></td>
  </tr>
  <tr>
    <td>13.</td>
    <td><input name="foto[]" size="20"></td>
    <td><input name="a4[]" size="5"></td>
    <td><input name="a3[]" size="5"></td>
    <td><input name="otherside[]" size="20"></td>
  </tr>
  <tr>
    <td>14.</td>
    <td><input name="foto[]" size="20"></td>
    <td><input name="a4[]" size="5"></td>
    <td><input name="a3[]" size="5"></td>
    <td><input name="otherside[]" size="20"></td>
  </tr>
  <tr>
    <td>15.</td>
    <td><input name="foto[]" size="20"></td>
    <td><input name="a4[]" size="5"></td>
    <td><input name="a3[]" size="5"></td>
    <td><input name="otherside[]" size="20"></td>
  </tr>
</table>

</p>

<table width="509">
  <tr>
    <td height="38" class="iframe"><label for="Name2">Comment:</label></td>
  </tr>
  <tr>
    <td><textarea name="message" rows="5" cols="60"></textarea></td>
  </tr>
  <tr>
    <td colspan="2" style="text-align:center"><!-- We are grateful to you for keeping this link in place. thank you. -->
      <input type="submit" value="Send"></td>
  </tr>
</table>
</form>
<p> </p>
</body>
</html>

 

now i would like to know, how can i get it to mail in this form:

(filled out by customer)

1. 1234abc (custom name of photo - loaded from input name="foto[]")

  A4 - 1x (amount of prints - loaded from input name="A4[]")

  A3 - 3x (amount of prints- loaded from input name="A3[]")

  150x180mm - 1x (custom size field- loaded from input name="customsize[]")

 

2. 2345def

  A4 - 2x

  A3 - 1x

  150x180mm - 1x
 

3. etc etc

 

does it work with POST commant or somelike else?

Hi, Not 100% on the question, but I will try to help.

 

  • In your input text fields they are setup for array ( ie <input name="foto[]" size="20"> ) 
  • A good reference for array's: PHP ARRAYS *(You can also count how many values in arrays search: array_count_values )
  • To upload your files this might be helpful: W3SCHOOL
  • PHP MAILER : you can use this for reference: HERE
  • Compile all your text fields into the body/message variable.

 

Hope this helps you out.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.