Jump to content

Yann63

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by Yann63

  1. Hello,

    I am a PHP beginner and I  made a PHP page which inserts data into a MYSql database.

    ....
    $InsertQuery->Action = "insert";
      $InsertQuery->Table = "klanten";
      $InsertQuery->bindColumn("Klantnummer", "s", "".strtoupper(((isset($_POST["Klantnummer"]))?$_POST["Klantnummer"]:""))  ."", "WA_DEFAULT");
      $InsertQuery->bindColumn("Naam_organisatie", "s", "".strtoupper(((isset($_POST["Naam_organisatie"]))?$_POST["Naam_organisatie"]:""))  ."", "WA_DEFAULT");
      $InsertQuery->bindColumn("Adres_organisatie", "s", "".strtoupper(((isset($_POST["Adres_organisatie"]))?$_POST["Adres_organisatie"]:""))  ."", "WA_DEFAULT");
      $InsertQuery->bindColumn("Postcode_organisatie", "s", "".strtoupper(((isset($_POST["Postcode_organisatie"]))?$_POST["Postcode_organisatie"]:""))  ."", "WA_DEFAULT");
      $InsertQuery->bindColumn("Woonplaats_organisatie", "s", "".strtoupper(((isset($_POST["Woonplaats_organisatie"]))?$_POST["Woonplaats_organisatie"]:""))  ."", "WA_DEFAULT");
      $InsertQuery->bindColumn("BTW_plichtig", "s", "".strtoupper(((isset($_POST["BTW_plichtig"]))?$_POST["BTW_plichtig"]:""))  ."", "WA_DEFAULT");
      $InsertQuery->bindColumn("Email", "s", "".strtoupper(((isset($_POST["Email"]))?$_POST["Email"]:""))  ."", "WA_DEFAULT");
    ...

    After the insert, I want to send all the data with a mail to a recepient. But I can't find a way to code the "setForm" correctly with the inserted field "Email".

    <?php
    error_reporting(E_ALL);
    
    use PHPMailer\PHPMailer\PHPMailer;
    use PHPMailer\PHPMailer\src\Exception;
    
    require 'PHPMailer\PHPMailer\src\Exception.php';
    require 'PHPMailer\PHPMailer\src\PHPMailer.php';
    require 'PHPMailer\PHPMailer\src\SMTP.php';
    	
    $mail = new PHPMailer();
    $mail->IsSMTP(); 
    $mail->Host = "smtp.myhosting.be"; 
    $mail->SMTPAuth = true; 
    $mail->Username = 'username@domain.com';
    $mail->Password = 'password'; 
    $mail->setFrom = $_POST('Email');                  // doesn't work
    $mail->AddAddress('recipient@domain.com');
    $mail->Subject = "subject";
    $mail->Body = "text";   // in the body I want an overview of all the inserted data
    $mail->IsHTML(true); 
    if(!$mail->Send()) 
    { 
    echo "Error sending: " . $mail->ErrorInfo;; 
    } 
    $mail->ClearAddresses();
    $mail->ClearAttachments();
    ?>	

    How can I do that?
    Thank you in advance for your comments.

  2. Hello,

    5 years ago I created a website with a MySQL database and PHP 5.6 scripting with Dreamweaver CS6.
    Now I have to upgrade my pages to PHP 7.4.2 using Dreamweaver 2020 and using mysqli connection.

    How do I proceed to change my pages ? Do I have to rescript all my PHP pages or is there an easy way to adapt the pages.

    Thank you for helping out a PHP dummy. 

     

     

     

     

     

  3. Hello

     

    How can I add a specific font and fontsize to my mail body ?

     

     

    require("class.phpmailer.php");

    $mail = new PHPMailer();

    $mail->IsSMTP(); // Laat PHPMailer gebruik maken van een smtp server.

    $mail->Host = "smtp.mijnhostingpartner.nl"; // SMTP server van Mijn Hosting Partner

    $mail->SMTPAuth = true;

    $mail->Username = 'webmaster@blackfeet.be'; // Een geldig emailadres wat aangemaakt is bij Mijn Hosting Partner
    $mail->Password = 'yr2805'; // Het wachtwoord wat bij het emailadres hoort

    $mail->FromName=$_POST['NAAM'];
    $mail->Sender=$_POST['EMAIL'];

    $mail->AddAddress("webmaster@blackfeet.be");
    $mail->Subject = $subject;

    $mail->Body = $text;

    $mail->IsHTML(true); //Opmaak van de email is in HTML

    if(!$mail->Send())
    {
     echo "Error sending: " . $mail->ErrorInfo;;
    }

    echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
    ?>

     

  4. I want to see the content of a query on a webpage based on an option selected in a dropdown list (sort of filter function)

    I made following javascript and PHP script but doesn't receive the desired result (no records).

    What do I do wrong ?

    < script type="text/javascript">
    function MM_callJS(jsStr) { //v2.0
    var opd = document.form1.opdstatus.options[document.form1.opdstatus.selectedIndex].text;
    alert (opd);
    < ?php
    mysql_select_db($database_myconnection, $myconnection);
    if (opd == "Started") {
    $query_dashboard = "SELECT * FROM dashboard WHERE Status = 'ST' ORDER BY Deadline ASC";
    $dashboard = mysql_query($query_dashboard, $myconnection) or die(mysql_error());
    $row_dashboard = mysql_fetch_assoc($dashboard);
    $totalRows_dashboard = mysql_num_rows($dashboard);
    }
    if (opd == "Finished") {
    $query_dashboard = "SELECT * FROM dashboard WHERE Status = 'FN' ORDER BY Deadline ASC";
    $dashboard = mysql_query($query_dashboard, $myconnection) or die(mysql_error());
    $row_dashboard = mysql_fetch_assoc($dashboard);
    $totalRows_dashboard = mysql_num_rows($dashboard);
    }
    if (opd == "Pending") {
    $query_dashboard = "SELECT * FROM dashboard WHERE Status = 'PN' ORDER BY Deadline ASC";
    $dashboard = mysql_query($query_dashboard, $myconnection) or die(mysql_error());
    $row_dashboard = mysql_fetch_assoc($dashboard);
    $totalRows_dashboard = mysql_num_rows($dashboard);
    }
    if (opd == "All") {
    $query_dashboard = "SELECT * FROM dashboard ORDER BY Deadline ASC";
    $dashboard = mysql_query($query_dashboard, $myconnection) or die(mysql_error());
    $row_dashboard = mysql_fetch_assoc($dashboard);
    $totalRows_dashboard = mysql_num_rows($dashboard);
    }
    ?>
    }
    < /script>

     

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