Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6701517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:56:37+00:00 2026-05-26T06:56:37+00:00

I am having some trouble with getting my custom dashboard single_page to interact with

  • 0

I am having some trouble with getting my custom dashboard single_page to interact with the database correctly.

Screenshot: http://i54.tinypic.com/2lvh45d.jpg

Testimonial Code (single_pages/dashboard/testimonials.php): http://pastebin.com/PK4ziRih

newTestimonials.php Code:

<?php
defined('C5_EXECUTE') or die("Access Denied.");
$testimonial_name = $_POST['testimonial_name'];
$testimonial_content = $_POST['testimonial_content'];
$url = "http://www.eurofloors.co.nz/dashboard/testimonials/";

$con = mysql_connect('localhost', 'username', 'password');
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("eurofloo_website", $con);

$sql = "INSERT INTO testimonials (id, name, content) VALUES " . $testimonial_name . $testimonial_content;

mysql_query($sql);

/* Redirect browser */
header("Location:" .$url);
/* Make sure that code below does not get executed when we redirect. */
exit;
?>

save_testimonials.php Code:

<?php
defined('C5_EXECUTE') or die("Access Denied.");

$existing_testimonials_update = $_POST['data'];

$con = mysql_connect('localhost', 'username', 'password');
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("eurofloo_website", $con);

$sql = "INSERT INTO testimonials VALUES " . $existing_testimonials_update;

$result = mysql_query($sql);


mysql_close($con);

?>

My problem with this page is, when I submit the new testimonial form or click save on the data grid at the bottom. I get the Page Not Found error, because concrete5 can’t seem to see the php files set in the action attribute of the forms.
Is there an obvious reason why this would be happening or is it because I havn’t used the MVC approach?

Can you please point me the right direction?
The main thing I am looking for, is some sort of documentation of examples for controller & model syntax for db interaction and form data processing.

Any advice or resources given are very much appreciated.

ps: I am still quite new to PHP so I may be approaching the code for this in the wrong way.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:56:38+00:00Added an answer on May 26, 2026 at 6:56 am

    Ahh… yeah, you’re going to experience nothing but pain if you try to work around the routing system Concrete5 already has in place (as opposed to a little bit of pain working within it, unfortunately).
    I highly recommend reading this “how-to” in their documentation:

    http://www.concrete5.org/documentation/how-tos/developers/build-a-single-page-powered-editing-interface-for-concrete5/

    When you say you’re new to PHP, are you new to web programming in general, or are you already familiar with other languages and MVC frameworks? If the latter, then I will caution that there’s a really ugly thing going on in the above article, where different views for controller actions are all in one view file separated with a big “if” statement. If this offends your sensibilities like it does mine, I have figured out a way to make this work better, let me know if you want to see that. [EDIT: See https://github.com/jordanlev/c5_boilerplate_crud for a better technique. It works out-of-the-box on Concrete5.5.0 and higher. If you’re stuck on 5.4.x, you can apply this patch to your system to make that work properly: https://github.com/concrete5/concrete5/pull/147/files ]. If you’re new to programming in general, you can completely ignore this paragraph as it won’t make much sense 🙂

    As for the database code you’re using, if you are interacting with the Concrete5 database, don’t use all that mysql_connect stuff — C5 already establishes a database connection and it uses the ADODB library to interface with it, like so:

    $db = Loader::db();
    $sql = "INSERT INTO testimonials (name, content) VALUES ?, ?";
    $vars = array($testimonial_name, $testimonial_content);
    $db->query($sql, $vars);
    

    Note that I’ve left out the “id” from the list of fields of your insert statement — I’m guessing the id is an auto-increment primary key field in the MySQL table, which means you don’t insert anything for it (the database will just magically create its own number). This is a general MySQL thing, btw — doesn’t have anything to do with C5 specifically.

    If you wanted to connect to a different database, then the “Loader” code would be slightly different — see the “Connecting to Other Databases” section on this page: http://www.concrete5.org/documentation/developers/system/database-connectivity (and especially note the last line in the sample code there that resets the connection when done — you must do this otherwise Concrete5 will fail miserably after your custom code runs).

    Good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble getting a custom config section to work. It's some code I
I'm having some trouble getting my button text to align correctly in my Android
I'm having some trouble getting a jQuery plugin to work correctly in my MVC
Having some trouble getting this query to work correctly. mysql_query(DELETE FROM `table` WHERE `id`
I'm having some trouble getting this layout to work correctly in IE. The problem
I'm having some trouble getting log4net to work from ASP.NET 3.5. This is the
I'm having some trouble getting jQuery to play nice with DokuWiki - has anyone
I am having some trouble getting Elmah to work with url routing in an
I am having some trouble getting an interactive, animated plane created from a MovieClip
I'm having some trouble getting my Core Data entities to play nice and order

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.