Jump to content

PHP newbie, small question about putting line break in form


JOERI840

Recommended Posts

Hi all,

 

I amnew in php and took a form from somewhere...

The formis working and all data is put in an email message but to lay-out the email i want to know how to put a line break in the code.

 

this is a smallpiece of code

$pBerichtUser = 'Het volgende bericht heb je verstuurd via contact formulier:<br><hr><br>'.$_POST['naam'].$_POST['voornaam'].$_POST['bericht'];

 

now when the email is send, "naam", "voornaam" and "bericht" are written next to each other and i want them to be under each other.

Can someone tell me how to put the line break into this code?

 

thanks a lot !!

Link to comment
Share on other sites

still another problem....

 

it seems that i cannot put 2 items in the email tough i just copied the code from the other items...

can someone help out with this issue?

 

code in form:

<input type="text" name="telefoon" size="40" value="<?= $pTelefoon; ?>">

<input type="number" name="telefoon savonds" size="40" value="<?= $pTelav; ?>">

 

code to put in email:

$pBerichtUser = 'Het volgende bericht heb je verstuurd via contact formulier:<br><hr><br>'.$_POST['naam']."</br>".$_POST['voornaam']."</br>".$_POST['adres']."</br>".$_POST['postcode']."</br>".$_POST['gemeente']."</br>".$_POST['Telefoon']."</br>".$_POST['Telav']."</br>".$_POST['email']."</br>".$_POST['onderwerp']."</br>".$_POST['bericht'];

mail($_POST['email'],$cOndPre.' '.$_POST['onderwerp'].' '.$cOndSuf,$pBerichtUser,$pHeader);

 

anyone?????

 

Link to comment
Share on other sites

still another problem....

 

it seems that i cannot put 2 items in the email tough i just copied the code from the other items...

can someone help out with this issue?

 

code in form:

<input type="text" name="telefoon" size="40" value="<?= $pTelefoon; ?>">

<input type="number" name="telefoon savonds" size="40" value="<?= $pTelav; ?>">

 

code to put in email:

$pBerichtUser = 'Het volgende bericht heb je verstuurd via contact formulier:<br><hr><br>'.$_POST['naam']."</br>".$_POST['voornaam']."</br>".$_POST['adres']."</br>".$_POST['postcode']."</br>".$_POST['gemeente']."</br>".$_POST['Telefoon']."</br>".$_POST['Telav']."</br>".$_POST['email']."</br>".$_POST['onderwerp']."</br>".$_POST['bericht'];

mail($_POST['email'],$cOndPre.' '.$_POST['onderwerp'].' '.$cOndSuf,$pBerichtUser,$pHeader);

 

anyone?????

 

Use code tags! And post any error you are getting.

Also what are the valuse within: $_POST['email'], $cOndPre, $_POST['onderwerp'], $cOndSuf, $pBerichtUser, $pHeader

 

One last thing instead of '. $var['a'] .' you can just put {} around it.

echo "Example {$var['a']}";

Link to comment
Share on other sites

Also what are the valuse within: $_POST['email'], $cOndPre, $_POST['onderwerp'], $cOndSuf, $pBerichtUser, $pHeader

 

 

these are all working, so there is no problem...

also there is no error message, it seems that it is working... but in the email, only those two fields (telefoon and telav) stay empty (al tough there is an empty space at the place where they should be)

 

what do you mean with :One last thing instead of '. $var['a'] .' you can just put {} around it. ??

i dont see it in my code?

Link to comment
Share on other sites

In you form snippet,

<input type="text" name="telefoon" size="40" value="<?= $pTelefoon; ?>">
<input type="number" name="telefoon savonds" size="40" value="<?= $pTelav; ?>">

telefoon is NOT capitalized but in your mail snip

 

$pBerichtUser = 'Het volgende bericht heb je verstuurd via contact formulier:<br><hr><br>'.$_POST['naam']."</br>".$_POST['voornaam']."</br>".$_POST['adres']."</br>".$_POST['postcode']."</br>".$_POST['gemeente']."</br>".$_POST['Telefoon']."</br>".$_POST['Telav']."</br>".$_POST['email']."</br>".$_POST['onderwerp']."</br>".$_POST['bericht'];
         mail($_POST['email'],$cOndPre.' '.$_POST['onderwerp'].' '.$cOndSuf,$pBerichtUser,$pHeader);

it is "$_POST['Telefoon']". So you are working with two different variables here.

Link to comment
Share on other sites

You can put anything you want (almost) inside the message: (I have rearranged the code just to make my point clearer.  Each value is on a separate line (as it is in the email), so just add the literals in that you want:

$pBerichtUser = 'Het volgende bericht heb je verstuurd via contact formulier:<br><hr><br>' . 
"Name: " . $_POST['naam'] . "</br>" .
"Surname: " . $_POST['voornaam'] . "</br>" .
"Address: " . $_POST['adres'] . "</br>" .
"Post Code: " . $_POST['postcode'] . "</br>" .
"Gender: " . $_POST['gemeente'] . "</br>" .
"Telephone: " . $_POST['Telefoon'] . "</br>" . 
"No Idea: " . $_POST['Telav'] . "</br>" .
"EMail: " . $_POST['email'] . "</br>" .
"Underwear?: " : $_POST['onderwerp'] . "</br>" . 
"Be Rich?: " . $_POST['bericht'];

mail($_POST['email'],$cOndPre.' '.$_POST['onderwerp'].' '.$cOndSuf,$pBerichtUser,$pHeader);

Forgive my translations, I only speak English.  I hope I didn't insult anybody.  :-[

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.