Wednesday, February 23, 2022

[FIXED] Display random generated characters on form to mail

Issue

I've created a form which will generate random characters and will be sent through mail, it works but it won't show the tracking number.

Here are my variables:

$length = 10;

$trackingcode = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);
$reqname = $_POST['reqname'];
$day = $_POST['day'];
$month = $_POST['month'];
$year = $_POST['year'];
$empname = $_POST['empname'];
$position = ($_POST['position']);
$account = $_POST['account'];
$platform = $_POST['platform'];
$processor = $_POST['processor'];
$ram = $_POST['ram'];
$monitor = $_POST['monitor'];
$phone = $_POST['phone'];
$phonetype = $_POST['phonetype'];
$headset = $_POST['headset'];
$status = $_POST['status'];
$approval = $_POST['approval'];

And here's the form to mail code:

$message .= "<tr style='background: #CDD9FF;'><td><strong>Tracking Code</strong> </td><td style='color:blue;'>" . strip_tags($_POST['trackingcode']) . "</td></tr>";

For some reason it won't post, I think because I used $_POST, correct me if I'm wrong. What should I do?


Solution

You have to use this

$message .= "<tr style='background: #CDD9FF;'><td><strong>Tracking Code</strong> </td><td style='color:blue;'>" . $trackingcode) . "</td></tr>";


Answered By - Siddharth Ramani

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.