Forums

Newbie. Where does it save the data?

SwingeyP 13 Jan, 2021
HI. I have created a simple form CF7.

Where does the data actually get stored?
Can I define the table to store the data? How?

I read in another post about adding the savedata to the end of the form but I can't see how.

Paul
Max_admin 15 Jan, 2021
you should add a "Save Data" action to the last page of the form (usually, unless you have other reasons to save the data earlier)

You should check the video tutorials from the link in my signature, it will show you how to use actions in general!
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
SwingeyP 15 Jan, 2021
Thanks for your response.

I have added the Save Data action and the External Database but I am still getting nowhere.
How do I setup the connection to the external database. In this case?

SwingeyP 15 Jan, 2021
Hi,
I managed to fathom out database connection for 'read' with the following script applied to the HTML / RUN PHP actions.

<?php

// Get the Joomla user info
$user =& JFactory::getUser();
$name = '';
$email = '';
$readonly = '';
if ( $user->id > 0 ) {
$ID = $user->id;
$UserName = $user->username;
$readonly = "readonly='readonly'";
}

//Setup the LFT database connection (LFT_DATA not the Joomla instance)
$servername = "localhost";
$username = "LFT_DataUser";
$password = "[Ur1dirm3p]";
$dbname = "LFT_DATA";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}

$sql = "SELECT JoomlaID, SiteID, SiteName FROM SiteDetails"; // where Joomla UserID = SiteID or something like that.
$result = $conn->query($sql);

if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "Joomla id: " . $row["JoomlaID"]. "<br>". "Site Name: " . $row["SiteName"]. "<br>". "Site Id: " . $row["SiteID"]. "<br>";
}
} else {
echo "0 results";
}
$conn->close();
?>

It's a bit clumsy but OK for this test.

What I want to know now is can I assign the values to a field on the form. Ie create a text field called Site ID and have it display what is in $row["SiteID"]

Paul
Max_admin 20 Jan, 2021
Answer
if you set the value to a variable:
$this->set("var_name", 123);
then you can use {var:var_name} in the field value setting
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
You need to login to be able to post a reply.