JOERI840 Posted April 23, 2010 Share Posted April 23, 2010 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 !! Quote Link to comment https://forums.phpfreaks.com/topic/199466-php-newbie-small-question-about-putting-line-break-in-form/ Share on other sites More sharing options...
cs.punk Posted April 23, 2010 Share Posted April 23, 2010 $pBerichtUser = 'Het volgende bericht heb je verstuurd via contact formulier:<br><hr><br>'.$_POST['naam']. "</br>" .$_POST['voornaam']. "</br>" .$_POST['bericht']; Quote Link to comment https://forums.phpfreaks.com/topic/199466-php-newbie-small-question-about-putting-line-break-in-form/#findComment-1046895 Share on other sites More sharing options...
oni-kun Posted April 23, 2010 Share Posted April 23, 2010 $pBerichtUser = 'Het volgende bericht heb je verstuurd via contact formulier:<br><hr><br>'.$_POST['naam']. "</br>" .$_POST['voornaam']. "</br>" .$_POST['bericht']; What's with the </br>'s? Quote Link to comment https://forums.phpfreaks.com/topic/199466-php-newbie-small-question-about-putting-line-break-in-form/#findComment-1046897 Share on other sites More sharing options...
JOERI840 Posted April 23, 2010 Author Share Posted April 23, 2010 ok the "</br>" worked i just did'nt know where to put exactly (before ".", after "." etc.... anyway, thanks a lot !!! Quote Link to comment https://forums.phpfreaks.com/topic/199466-php-newbie-small-question-about-putting-line-break-in-form/#findComment-1046899 Share on other sites More sharing options...
JOERI840 Posted April 23, 2010 Author Share Posted April 23, 2010 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????? Quote Link to comment https://forums.phpfreaks.com/topic/199466-php-newbie-small-question-about-putting-line-break-in-form/#findComment-1046910 Share on other sites More sharing options...
cs.punk Posted April 23, 2010 Share Posted April 23, 2010 $pBerichtUser = 'Het volgende bericht heb je verstuurd via contact formulier:<br><hr><br>'.$_POST['naam']. "</br>" .$_POST['voornaam']. "</br>" .$_POST['bericht']; What's with the </br>'s? Sorry I meant <br/> :-\ Quote Link to comment https://forums.phpfreaks.com/topic/199466-php-newbie-small-question-about-putting-line-break-in-form/#findComment-1046916 Share on other sites More sharing options...
cs.punk Posted April 23, 2010 Share Posted April 23, 2010 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']}"; Quote Link to comment https://forums.phpfreaks.com/topic/199466-php-newbie-small-question-about-putting-line-break-in-form/#findComment-1046926 Share on other sites More sharing options...
JOERI840 Posted April 23, 2010 Author Share Posted April 23, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/199466-php-newbie-small-question-about-putting-line-break-in-form/#findComment-1046939 Share on other sites More sharing options...
oni-kun Posted April 23, 2010 Share Posted April 23, 2010 "</br>".$_POST['Telav']." Can become: "<br/>{$_POST['Telav']}" You never needed to concatinate the string (via closing the quotes and using the "."). Quote Link to comment https://forums.phpfreaks.com/topic/199466-php-newbie-small-question-about-putting-line-break-in-form/#findComment-1046941 Share on other sites More sharing options...
JOERI840 Posted April 23, 2010 Author Share Posted April 23, 2010 result stays the same Quote Link to comment https://forums.phpfreaks.com/topic/199466-php-newbie-small-question-about-putting-line-break-in-form/#findComment-1047241 Share on other sites More sharing options...
JOERI840 Posted April 24, 2010 Author Share Posted April 24, 2010 anyone another suggestion? Quote Link to comment https://forums.phpfreaks.com/topic/199466-php-newbie-small-question-about-putting-line-break-in-form/#findComment-1047574 Share on other sites More sharing options...
DavidAM Posted April 24, 2010 Share Posted April 24, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/199466-php-newbie-small-question-about-putting-line-break-in-form/#findComment-1047645 Share on other sites More sharing options...
JOERI840 Posted April 24, 2010 Author Share Posted April 24, 2010 YES !!!!!! thank you very much !!!!! one other question, is it possible to put in the email message in front of the data to put what it is? like TELEFOON: and then here the data from "telefoon" ??? thanks again !! Quote Link to comment https://forums.phpfreaks.com/topic/199466-php-newbie-small-question-about-putting-line-break-in-form/#findComment-1047697 Share on other sites More sharing options...
DavidAM Posted April 24, 2010 Share Posted April 24, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/199466-php-newbie-small-question-about-putting-line-break-in-form/#findComment-1047716 Share on other sites More sharing options...
JOERI840 Posted April 24, 2010 Author Share Posted April 24, 2010 ok it works!! thanks again oh, for the information: "onderwerp" means "subject" and "bericht" means message.... all in dutch ) so no underwear for the one that's rich Quote Link to comment https://forums.phpfreaks.com/topic/199466-php-newbie-small-question-about-putting-line-break-in-form/#findComment-1047745 Share on other sites More sharing options...
DavidAM Posted April 24, 2010 Share Posted April 24, 2010 Oh, got it. Thought you might be looking for rich ones that don't wear underwear. Quote Link to comment https://forums.phpfreaks.com/topic/199466-php-newbie-small-question-about-putting-line-break-in-form/#findComment-1047749 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.