problem with form in php

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default problem with form in php

    Hi,
    i have a problem with a form. In my page there is the following code:


    --------------------------------------------------------------------------------

    <script language="javascript">
    <!--
    function Modulo() {
    // Variabili associate ai campi del modulo
    var news_titolo = document.news.newstitolo.value;
    var news_sottotitolo = document.news.newssottotitolo.value;
    var news_contenuto = document.news.newscontenuto.value;
    var news_autore = document.news.newsadmin.value;
    //Effettua il controllo sul campo newstitolo
    if ((news_titolo == "") || (news_titolo == "undefined")) {
    alert("Inserire il titolo della news");
    document.news.newstitolo.focus();
    return false;
    }
    //Effettua il controllo sul campo newssottotitolo
    else if ((news_sottotitolo == "") || (news_sottotitolo == "undefined")) {
    alert("Inserire il sottotilo della news");
    document.news.newssottotitolo.focus();
    return false;
    }
    //Effettua il controllo sul campo newscontenuto
    else if ((news_contenuto == "") || (news_contenuto == "undefined")) {
    alert("Inserire il contenuto della news");
    document.news.newscontenuto.focus();
    return false;
    }
    //Effettua il controllo sul campo newadmin
    else if ((news_autore == 0) || (news_autore == "undefined")) {
    alert("Inserire l'autore della news");
    document.news.newsadmin.focus();
    return false;
    }

    --------------------------------------------------------------------------------



    it's JavaScript code to check if all fields are compiled. In the beginning of the page i use the following code to check if $Invia exists:



    --------------------------------------------------------------------------------

    if (isset($Invia))
    {
    mysql_query("INSERT INTO engine_news (news_titolo, news_sottotitolo, news_data, news_ora, news_contenuto, admin_ID) VALUES ('$newstitolo','$newssottotitolo'," . CURRENT_DATE . "," . CURRENT_TIME .. ",'$newscontenuto','$newsadmin')");
    }
    else
    {

    --------------------------------------------------------------------------------


    after that the script writes a code for the form.
    I need to give a variable $Invia (the name of the button of the form) through the JavaScript.
    How i can do it?

    Tnx lnxsimon.
    lnxsimon Guest

  2. Similar Questions and Discussions

    1. Problem with CFM form.
      Hi everyone. I have a website for signing up for an event. It was working fine, but now everytime anyone tries to open the registration page they...
    2. Form Problem
      Hi, I've got an intranet site that allows a user to view a weekly diary on a page. Clicking on an item on a particular day...fires up a modal...
    3. Simple Form Problem!
      Hi, I am using a simple form 2 email program. I ama experienced programmer, But I feel very bad, as I am unable to fix this problem. All seems...
    4. is this a form problem?
      I have been wrestling with this problem for the past couple weeks, and I can't seem to get a solid answer from anyone I talk to...hopefully one or...
    5. Form Problem ! Please Help !
      My form and results are on one page. If I use : if ($Company) { $query = "Select Company, Contact From tblworking Where ID = $Company Order...
  3. #2

    Default Re: problem with form in php

    I'm glad, I've solved it.

    lnx simone.
    "lnxsimon" <fornarasimone@tin.it> ha scritto nel messaggio news:T1TMa.13518$HU3.417213@news2.tin.it...
    Hi,
    i have a problem with a form. In my page there is the following code:


    ------------------------------------------------------------------------------

    <script language="javascript">
    <!--
    function Modulo() {
    // Variabili associate ai campi del modulo
    var news_titolo = document.news.newstitolo.value;
    var news_sottotitolo = document.news.newssottotitolo.value;
    var news_contenuto = document.news.newscontenuto.value;
    var news_autore = document.news.newsadmin.value;
    //Effettua il controllo sul campo newstitolo
    if ((news_titolo == "") || (news_titolo == "undefined")) {
    alert("Inserire il titolo della news");
    document.news.newstitolo.focus();
    return false;
    }
    //Effettua il controllo sul campo newssottotitolo
    else if ((news_sottotitolo == "") || (news_sottotitolo == "undefined")) {
    alert("Inserire il sottotilo della news");
    document.news.newssottotitolo.focus();
    return false;
    }
    //Effettua il controllo sul campo newscontenuto
    else if ((news_contenuto == "") || (news_contenuto == "undefined")) {
    alert("Inserire il contenuto della news");
    document.news.newscontenuto.focus();
    return false;
    }
    //Effettua il controllo sul campo newadmin
    else if ((news_autore == 0) || (news_autore == "undefined")) {
    alert("Inserire l'autore della news");
    document.news.newsadmin.focus();
    return false;
    }

    ------------------------------------------------------------------------------



    it's JavaScript code to check if all fields are compiled. In the beginning of the page i use the following code to check if $Invia exists:



    ------------------------------------------------------------------------------

    if (isset($Invia))
    {
    mysql_query("INSERT INTO engine_news (news_titolo, news_sottotitolo, news_data, news_ora, news_contenuto, admin_ID) VALUES ('$newstitolo','$newssottotitolo'," . CURRENT_DATE . "," . CURRENT_TIME .. ",'$newscontenuto','$newsadmin')");
    }
    else
    {

    ------------------------------------------------------------------------------


    after that the script writes a code for the form.
    I need to give a variable $Invia (the name of the button of the form) through the JavaScript.
    How i can do it?

    Tnx lnxsimon.
    lnxsimon Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139