Can't add spaces, form to email handler

can definition
can synonym
can.'' acronym
can band
meaning of can in hindi
can network
can pronunciation
cant

Good morning,

I'm trying to add spaces to the words on my form. Here's an example:

Sample pic

For example, the "Referralname" and "Phonenumber" should be "Referral Name" and "Phone Number".

Here's the form:

<div class="container">
            <div class="row" style="margin-top: -10px;">
                <div class="col-md-6 col-md-offset-3">
                    <h2>Referral Form <a style="font-size: 10px;" href="../index.php">Back to homepage</a></h2>
                    <p> Send your referrals using the form below and we will get back to you as early as possible. </p>
                    <form role="form" method="post" id="reused_form" enctype=&quot;multipart/form-data&quot; >
                        <div class="form-group">
                            <label for="name"> Your Name:</label>
                            <input type="text" class="form-control" id="name" name="name" required maxlength="50">
                        </div>
                        <div class="form-group">
                            <label for="email"> Referral's Name:</label>
                            <input type="text" class="form-control" id="email" name="referralname" required maxlength="50">
                        </div>
                        <div class="form-group">
                            <label for="email"> Referral's Email:</label>
                            <input type="email" class="form-control" id="email" name="email" required maxlength="50">
                        </div>
                        <div class="form-group">
                            <label for="email"> Referral's Phone Number:</label>
                            <input type="text" class="form-control" id="email" name="phonenumber" required maxlength="50">
                        </div>
                        <div class="form-group">
                            <label for="name"> Message:</label>
                            <textarea class="form-control" type="textarea" name="message" id="message" placeholder="Your Message Here" maxlength="6000" rows="7"></textarea>
                        </div>
                        <div class="form-group">
                            <label for="name"> Upload Resumé:</label>
                            <input type="file" class="form-control" id="image" name="image" required>
                        </div>
                        <button type="submit" class="btn btn-lg btn-success pull-right" id="btnContactUs">Send! &rarr;</button>
                    </form>
                    <div id="success_message" style="width:100%; height:100%; display:none; "> <h3>Sent your message successfully!</h3> </div>
                    <div id="error_message" style="width:100%; height:100%; display:none; "> <h3>Error</h3> Sorry there was an error sending your form. </div>
                </div>
            </div>
        </div>

You could do something like this

private function compose_mail($post)
    {
        $content = "Form submission: \n\n";
        foreach($post as $name=>$value)
        {
            $content .= ucwords($name).":\n";
            $content .= "$value\n\n";
        }
        $content = str_replace("Referralname", "Referral Name", $content);
        $content = str_replace("Phonenumber", "Phone number", $content);
        $this->mailer->Body  = $content;
    }

Can, Can was the leading avant-garde rock group of the 70s. Can experimented with noise, synthesizers, non-traditional music, cut-and-paste techniques, and, most  Can definition, to be able to; have the ability, power, or skill to: She can solve the problem easily, I'm sure. See more.

"Referral's Name" is a label. It's only good for user interaction. Your PHP code never sees it.

"referralname" is the name of an INPUT control of type "text". This is what your code uses.

You can't (or at least shoudn't) add spaces and punctuation to a field name. There's no need for them to be identical.

Can, VerbEdit. can (third-person singular simple present can, present participle -, simple past could, past participle (obsolete except in  Define can. can synonyms, can pronunciation, can translation, English dictionary definition of can. to be able to, have the power or skill to: I can take a bus to the

I think that you want that space in the body of the e-mail. So try this adding these 2 lines in php:

        $content = str_ireplace('Referralname', 'Referral Name', $content);
        $content = str_ireplace('Phonenumber', 'Phone Number', $content);

        //right before this line:
        $this->mailer->Body  = $content;

Php function str_ireplace will replace the first string with the second, but only in the body of e-mail.

Str_ireplace or str_replace should be the same for you. The former is case-insensitive, the latter is case-sensitive.

The Official CAN / Spoon Records Website, can meaning: 1. to be able to: 2. used to say that you can and will do something: 3. to be allowed to: . Learn more. 110 synonyms of can from the Merriam-Webster Thesaurus, plus 97 related words, definitions, and antonyms. Find another word for can. Can: to bring (as an action or operation) to an immediate end.

can, 1.1Be able to through acquired knowledge or skill. 'I can speak Italian'. More example sentences. Can (stylised as CAN) was a German experimental rock band formed in Cologne in 1968 by the core quartet of Holger Czukay (bass, tape editing), Irmin Schmidt (keyboards), Michael Karoli (guitar), and Jaki Liebezeit (drums).

CAN, What The 1918 Flu Can Teach Us About Handling Today's Pandemic. Facebook; Twitter; Flipboard; Email. May 15, 20205:00 AM ET. A Controller Area Network (CAN bus) is a robust vehicle bus standard designed to allow microcontrollers and devices to communicate with each other's applications without a host computer. It is a message-based protocol , designed originally for multiplex electrical wiring within automobiles to save on copper, but can also be used in many other

Can, The definition of a can is a container normally made of metal with a lid. An example of can is what tuna comes in. verb. Can means someone or something knows  We would like to show you a description here but the site won’t allow us.

Comments
  • So, what's your question? Everything seems pretty fine.
  • I wanted to add space to the words, for example the, "Referralname" should be "Referral Name" @ChukwuemekaInya
  • I'm not sure where it's dispaying incorrectly. Is it the "Referral's Name" in the html code that you are referring to (it's "Referral's" not "Referral")? And if that's the case, I'm not sure why you are displaying the php code.
  • @Andri there should be a space between Referralname. So Referralname should be Referral Name
  • But there is no "Referral Name" in your code. Just "Referral's Name". Is that what you mean?
  • It's a very simplified solution. But should do the trick. It's simply doing "find and replace" in the text after the code is done, but it would make it work.
  • I'm just adding this code: $content = str_replace("Referralname", "Referral Name", $content); to the compose_mail function. If you want to replace more text, you can just add more of those lines.
  • This is noted, thank you so much!!
  • Glad I could help
  • The form is good, but when I get the email, I dont get the spaces between. Please see attached email composition code
  • Are you talking about the email address? Do want "First Last <firstlast@example.org>"?