Welcome Guest, Not a member yet? Register   Sign In
How to set C_I 4+ multi-variable mail post
#1

Hi guys below have a question I want to add more input mail variables is there any one can assist me better way please

PHP Code:
<?php 
namespace App\Controllers;
use 
App\Models\FormModel;
use 
CodeIgniter\Controller;

class 
SendMailController extends Controller
{

    public function 
index() 
    {
        return 
view('form_view');
    }

    function 
sendMail() { 
        
$to='[email protected]';
        
        
$from $this->request->getVar('mailTo');
        
$subject $this->request->getVar('subject');
        
$message $this->request->getVar('message');
       
/*$solo = $this->request->getVar('solo');   here I want to add more input*/ 
      /*$solo = $this->request->getVar('solo2') ; here I want to add more input*/
        
        
$email = \Config\Services::email();
       
        
$email->setTo($to);
        
$email->setFrom($from'Thank you');
        
        
$email->setSubject($subject);
        
$email->setMessage($message);/*i want to chunk message  here*/

        //This is wrong
        //$email->setBody($solo);
       //$email->setBody($solo2);

        
if ($email->send()) 
        {
            
//echo 'Email successfully sent';
            
return redirect()->back()->with('message''Email successfully sent');

        } 
        else 
        {
            
$data $email->printDebugger(['headers']);
            
print_r($data);
        }
    }




and here is a form

Code:
<form>
<input name="mailTo"/>
<input name="subject"/>
<input name="message"/>
<input name="solo"/>
<input name="solo2"/>
</form>
Codeigniter First, Codeigniter Then You!!
yekrinaDigitals

Reply
#2

See https://www.php.net/manual/en/language.o...string.php
Reply
#3

(01-29-2022, 05:46 PM)kenjis Wrote: See https://www.php.net/manual/en/language.o...string.php

thank y6ou kenji (concatenation operator|.|) got solved
Codeigniter First, Codeigniter Then You!!
yekrinaDigitals

Reply




Theme © iAndrew 2016 - Forum software by © MyBB