Ask a Question related to PHP Development, Design and Development.
-
lnxsimon #1
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
-
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... -
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... -
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... -
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... -
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... -
lnxsimon #2
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



Reply With Quote

