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

  • Home
  • SEARCH
  • 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 8842445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:57:38+00:00 2026-06-14T10:57:38+00:00

I trying to separate the code php and the code html in 2 files.

  • 0

I trying to separate the code php and the code html in 2 files.

So I’m doing many functions that will be executed in different part of my page.

For the moment I’m trying to make a function for saving a small form data.

So I have written that code:

function addAnnonce($session) {
    $sql = "SELECT `nom`,`prenom`,`type` FROM `gestionnaire` WHERE `id`={$session}";
    $result = mysql_query($sql);
    $donnees = mysql_fetch_assoc($result);
}

function saveAnnonce($form, $annonce, $to) {
    if (isset($form)) {
        addAnonce($_SESSION['login']);
        $by = $donnees['nom'] . ' ' . $donnees['prenom'];
        $sql = "INSERT INTO `cometchat_announcements` SET
    `announcement`  ='" . mysql_real_escape_string($annonce) . "',
    `by`            ='" . mysql_real_escape_string($by) . "',
    `time`          ='" . mysql_real_escape_string(time()) . "',
    `to`            ='" . mysql_real_escape_string($to) . "'";
        mysql_query($sql);
        echo "<div class=\"success\">L'annoncea bien &eacute;t&eacute; ajout&eacute;e , vous pouvez continuer vos actions<br>La mise &agrave; jour interviendra apr&egrave;s actualisation</div>";
        echo "<SCRIPT type=\"text/javascript\"> 
<!-- 
alert(\"Ajout d\'une nouvelle annonce : Ok !\");
// --> 
</SCRIPT> ";
    }
}
    isset($_POST['enreg']) ? saveAnnonce($_POST['enreg'], $_POST['annonce'],$_POST['to']) :'' ;

The trouble is that it display to me a blank page.

I really do not understand why.

It should display the form but I think something is wrong but I can not see what.

I’ve tried it with xdebug but it does not show to me nothing.

Any kind of help will be much appreciated.

  • 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-06-14T10:57:39+00:00Added an answer on June 14, 2026 at 10:57 am

    You are not returning $donnees to the workflow, so $donnees in saveAnnonce() is not defined.

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

Sidebar

Related Questions

I am trying to initialize a dataTable from a separate .php file that builds
I understand that you can put your $(document).ready() code into separate files from the
Hey guys, I have the following HTML structure that I am trying to pull
I'm trying to (in php) Verify that the contents of a textarea are valid
I'm trying to make my website scroll to specific post that is on separate
I have this test page: http://www.problemio.com/index_new.php and I am trying to make some jQuery
I'm trying to create a system in PHP/Zend that can gather emails from various
I am trying to separate a few things in here. I have a program
I am trying to separate my logic for better readability and re-useability. I am
I'm trying to basically trying to separate a specific amount of text from the

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.