Jump to content

Search the Community

Showing results for tags 'line break'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 3 results

  1. Hi everyone, I am running into an issue when I am sending out emails using the mail() function. What I am trying to do is on one page, there is a text area that enters information into a form and sends it to another php to process. Here is the form: <form method='POST' action='../home/contact-send-email.inc.php'> <div class='input_form'> <input type='hidden' name='cid' value='".$rowcon['cid']."'><br> <input type='hidden' name='from' value='".$_SESSION['email']."'><br> <input type='hidden' name='email' value='".$rowcon['email']."'><br> <input type='text' name='subject' placeholder='Subject'><br> <textarea style='width: 103.5%; height: 500px; resize: none;' type='text' name='message' placeholder='Message'></textarea><br> <button type='submit'>Send Mail</button> </div> </form> Now with the text area, I want it to allow line breaks. The issue I am running into now is that when I send email out, I am getting the text but were I put the line breaks, there is a \r\n in text. Here is the mail process php: <?php include '../inc/dbh.php'; $from = mysqli_real_escape_string($conn, $_POST['from']); $msg = mysqli_real_escape_string($conn, $_POST['message']); $to = mysqli_real_escape_string($conn, $_POST['email']); $subject = mysqli_real_escape_string($conn, $_POST['subject']); $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type:text/html; charset=UTF-8\r\n"; $headers .= "From: ".$from."\r\n"; $headers .= "X-Mailer: PHP 5.x\r\n"; $txt = nl2br($msg); mail($to, $subject, $txt, $headers); ?> So quick over view: When I send an email out using this code and there are line breaks in there, where the line breaks are happening, in the email there is \r\n instead of the line break.
  2. Good morning, I'm using Firefox on a Fedora-23 system, both current as of 2016-08-18. In an html file, I have a Javascript script to randomize the selection of an image and its caption by choosing it based on the time when the page is loaded. The selection works great. But the caption strings (in a Javascript array) are long. I've tried a few different ways of putting a line break in the string, so that they display in the web page as two lines. I've also tried "<br/>" (no space before the slash). Nothing works. What is the elegant, best practice way of putting a line break in the place where I want it within a long caption in this scenario? (I very probably could come up with a "brute force" way - like two arrays, but that's tedious, especially if I have a much larger number of pictures and captions.) By the way, it's curious that when I go to the W3Schools JavaScript Strings tutorial, run the second "Try it Yourself", embed "<br />" in a one of the strings, and run it, I do get the line break where I want it in the output string! I'd also like the caption to end with " (picture #i of n)". I want *two* spaces before the '('; it looks much better that way. But additional spaces beyond one apparently get parsed off when the page loads. What is the elegant, best practice way of getting the desired amount of additional space there? I am unable to attach the html and css files, so I've included them at the end of this message's body, below the signature. Thank-you for your help. Bill. <!-- ============= --> <!-- "testjs.html" --> <!-- ============= --> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <!-- ===================================================================== --> <head> <meta charset="UTF-8"> <link rel="stylesheet" type="text/css" href="testjs.css"/> <title>Test Javascript Page</title> </head> <!-- ===================================================================== --> <body> <!-- ===================================================================== --> <table id="page_table" style="width:100%"> <tr> <td id="page_cell"> <!-- ===================================================================== --> <h1> <a id="pagetop"></a> Test Javascript Web Page</h1> <p> <br /> </p> <table> <tr> <td style="padding: 0;"> <img id="TestPic" alt=""/> </td> </tr> </table> <p id="TestCaption" class="photocaption"> </p> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <script type="text/javascript"> var captions = [ "first line of long caption for first test image<br>meta-data part of long caption for first test image" , "second test image, long caption, top line<br />second test image, long caption, meta-data part" , "1st line of long caption for 3rd test image\nmeta-data line of long caption for 3rd test image" , "4th test image, long caption, top line" + "<br />" + "4th test image, long caption, meta-data line" , "upper line of long caption for test image #5" + '\n' + "meta-data line of long caption for test image #5" ]; var d = new Date(); var newPic = "TestImage"; var picnum = d.getSeconds()%5; document.getElementById ( "TestCaption" ).textContent = captions[picnum] + " (picture #" + (++picnum) + " of 5)"; newPic = newPic + picnum + ".jpg"; document.getElementById ( "TestPic" ).src = newPic; </script> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- other stuff goes here --> <!-- ===================================================================== --> </td> </tr> </table> <!-- ===================================================================== --> </body> </html> <!-- ================= --> <!-- end "testjs.html" --> <!-- ================= --> ************************* (here is the associated css file) ************************* /*==============*/ /* "testjs.css" */ /*==============*/ /*------*/ /* body */ /*------*/ body { background-color: #000000; margin-top: 5mm; margin-bottom: 5mm; margin-left: 5mm; margin-right: 5mm; color: #ff8f6f; text-align: center; /* needed in IE for table centering */ font-family: Times, serif; font-size: 5.6mm; } /*----------*/ /* headings */ /*----------*/ h1 { background-color: transparent; text-align: center; color: #ffff00; } h2 { background-color: transparent; text-align: left; color: #ffff00; } h3 { background-color: transparent; text-align: left; color: #ff9faf; } /*-------------------*/ /* named text styles */ /*-------------------*/ .photocaption { text-align: center; background-color: transparent; font-style: italic; font-size: 100%; color: #ff9faf; } /*===================================*/ /*------------*/ /* page table */ /*------------*/ table#page_table { margin: auto; background-color: #e7a070; color: #ff8f6f; border-collapse: separate; border-spacing: 5mm; border: outset 2mm; } /*-----------------*/ /* page table cell */ /*-----------------*/ td#page_cell { text-align: center; vertical-align: middle; background-color: #270f00; color: #ff8f6f; border: inset 2mm #ff8f6f; padding: 15mm; } /*===================================*/ /*-------*/ /* table */ /*-------*/ table { margin: auto; background-color: #e7a070; color: #ff8f6f; border-collapse: separate; border-spacing: 2mm; border: outset 1.4mm; } /*------------*/ /* table cell */ /*------------*/ td { text-align: center; vertical-align: middle; background-color: #3f1700; color: #ff8f6f; border: inset 1mm #ff8f6f; padding: 3mm; } /*==================*/ /* end "testjs.css" */ /*==================*/
  3. Hi, I've been working with the indeed jobs API and I have a line break after the title that Id'like to get rid off. Jobs Results: Graduate Scheme - 2015 Crossrail Ltd (2 days ago) London - Crossrail vacancies Graduate Scheme - 2015 Graduate Scheme - 2015 Job title Graduate Scheme - 2015... visit our designated Graduate Scheme page for more... Here is the code: foreach($xml->results->result as $result) {echo "<h3><a href=".$result->url.">".$result->jobtitle."</a></h3>";echo "<p><b>".$result->company."</b> (".$result->formattedRelativeTime.") <b>".$result->city."</b> - ".$result->snippet."</p>";} ?> I can't find out why there is a line break between the two echo, any idea? Many Thanks,
×
×
  • Create New...