close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Record Insert Success or Unsuccessful message

Thread began 2/13/2021 12:16 pm by Michael | Last modified 2/15/2021 9:51 am by Ray Borduin | 38 views | 5 replies |

Michael

Record Insert Success or Unsuccessful message

Please how can I add a success message that reads thus "Record Inserted Successfully" whenever my records are inserted into the database or "Record insert was not Successfully"

Here is my code

<?php
if ($_SERVER["REQUEST_METHOD"] === "POST") {
$InsertQuery = new WA_MySQLi_Query($SFT);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "findings";
$InsertQuery->bindColumn("indg_id", "i", "".((isset($_POST["indg_id"]))?$_POST["indg_id"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("ind_id", "i", "".((isset($_POST["ind_id"]))?$_POST["ind_id"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("question", "s", "".((isset($_POST["question"]))?$_POST["question"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("findings", "s", "".((isset($_POST["findings"]))?$_POST["findings"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("conclusion", "s", "".((isset($_POST["conclusion"]))?$_POST["conclusion"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("recomdns", "s", "".((isset($_POST["recomdns"]))?$_POST["recomdns"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("addedby", "s", "".((isset($_POST["addedby"]))?$_POST["addedby"]:"") ."", "WA_DEFAULT");
$InsertQuery->saveInSession("fin_id");
$InsertQuery->execute();
$InsertGoTo = "dlis";
if (function_exists("rel2abs")) $InsertGoTo = $InsertGoTo?rel2abs($InsertGoTo,dirname(__FILE__)):"";
$InsertQuery->redirect($InsertGoTo);
}
?>

Thank you

Sign in to reply to this post

Ray BorduinWebAssist

Add a url parameter to your success redirect and then show the success message when the url parameter exists like:

php:
<?php

if (isset($_GET["success"])) {
?>
Success Message Here
<?php
}
?>
Sign in to reply to this post
Did this help? Tips are appreciated...

Michael

Record Insert Success or Unsuccessful message

Originally Said By: Ray Borduin
  Add a url parameter to your success redirect and then show the success message when the url parameter exists like:
php:
<?php

if (isset($_GET["success"])) {
?>
Success Message Here
<?php
}
?>
  



Thank you so much but I am not sure I know how to add a url parameter to my success redirect. Please help me with the full code including the URL Parameter you mentioned.

Thank you

Sign in to reply to this post

Ray BorduinWebAssist

$InsertGoTo = "yoursuccesspage.php?success";

Sign in to reply to this post
Did this help? Tips are appreciated...

Michael

Record Insert Success or Unsuccessful message

Originally Said By: Ray Borduin
  $InsertGoTo = "yoursuccesspage.php?success";  



Thank you so so much.

Now putting all together I should get this right

<?php
if ($_SERVER["REQUEST_METHOD"] === "POST") {
$InsertQuery = new WA_MySQLi_Query($SFT);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "findings";
$InsertQuery->bindColumn("indg_id", "i", "".((isset($_POST["indg_id"]))?$_POST["indg_id"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("ind_id", "i", "".((isset($_POST["ind_id"]))?$_POST["ind_id"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("question", "s", "".((isset($_POST["question"]))?$_POST["question"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("findings", "s", "".((isset($_POST["findings"]))?$_POST["findings"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("conclusion", "s", "".((isset($_POST["conclusion"]))?$_POST["conclusion"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("recomdns", "s", "".((isset($_POST["recomdns"]))?$_POST["recomdns"]:"") ."", "WA_DEFAULT");
$InsertQuery->bindColumn("addedby", "s", "".((isset($_POST["addedby"]))?$_POST["addedby"]:"") ."", "WA_DEFAULT");
$InsertQuery->saveInSession("fin_id");
$InsertQuery->execute();
$InsertGoTo = "dli?success";
if (function_exists("rel2abs")) $InsertGoTo = $InsertGoTo?rel2abs($InsertGoTo,dirname(__FILE__)):"";
$InsertQuery->redirect($InsertGoTo);
}
?>

<?php
if (isset($_GET["success"])) {
?>
Success Message Here
<?php
}
?>

Sign in to reply to this post

Ray BorduinWebAssist

Yes, that should work.

Sign in to reply to this post
Did this help? Tips are appreciated...

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...