473,385 Members | 1,402 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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.
Jul 16 '05 #1
1 2315
I'm glad, I've solved it.

lnx simone.
"lnxsimon" <fo***********@tin.it> ha scritto nel messaggio news:T1********************@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.
Jul 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Aaron Prohaska | last post by:
I have just run into a problem where I have a page that posts back to itself to execute code, except when the page does the post back it somehow executes code that is in our home page for the site....
0
by: CSDunn | last post by:
Hello, I have a problem with field filtering between an Access 2000 Project form (the application is called CELDT), and the report that shows the results of the filter. Both the form and the...
4
by: William Wisnieski | last post by:
Hello Everyone, Access 2000 I have a form with multiple pages on it. There is one text field on the third page of the form that I need the user to complete before leaving the form or moving...
3
by: dixie | last post by:
I have an Access 2000 form which has been running OK for a long time. Lately, it is playing up and doing things like causing Access to close suddenly when the form is opened or when saving the form...
9
by: Rajat Tandon | last post by:
Hello there, I am relatively new to the newsgroups and C#. I have never been disappointed with the groups and always got the prompt replies to my queries.This is yet another strange issue, I am...
7
by: Frank Maxey | last post by:
I am fairly new to VB.Net and am having a curious problem. I have an entry dialog form called from a main form. The calling form needs to check the DialogResult field for an OK response. In...
7
by: Trickynick1001 | last post by:
Hi, a newbie here. I don't have a real firm grasp on the idea of Javascript, as I'm used to programming in Qbasic and C. I'm not used to OOP. Anyway, I really don't have any idea what the...
9
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a...
7
xNephilimx
by: xNephilimx | last post by:
lHi guys! I'm having a little problem that's getting on my nerves, I couldn't find a solution, I also tryed googling it and I found nothing... (my field of expertise is in AS 2 and 3, but I still...
1
by: swathichavalla | last post by:
Problem description: Clients working with an apple computer with the safari browser are experiencing problems with brokerage orders. When the client wants to enter a stock order, the order entry...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.