Products
ChronoForms
ChronoConnectivity
ChronoForums
Buy
FAQs
Forums
Contact
Blog
Buy Now
Sign in
You are here:
Home
Forums
General Forums
Joomla General Questions
Contact Form and GDPR Compliance
...
00:25
January 16 2021, 00:25
Newbie. Where does it save the data?
SwingeyP
,
January 13 2021, 14:27
Share this topic
1 - 4 of 4
1
S
SwingeyP
7
January 13 2021, 14:27
#395659
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
admin
32
January 15 2021, 03:57
#395674
Answer
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
ChronoForms7 Video Tutorials
S
SwingeyP
7
January 15 2021, 14:41
#395681
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?
Attachments
DatabaseConnection.PNG
(26.41 KiB)
3 Downloads/Views
S
SwingeyP
7
January 15 2021, 17:01
#395683
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
1 - 4 of 4
1
Products
ChronoForms
ChronoConnectivity
ChronoForums
Buy
FAQs
Forums
Contact
Blog
Username
Password
Remember Me
Forgot your password?
Forgot your username?
Create an account
ChronoForms7 Video Tutorials
// 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.