need help with saving two forms in php
09-20-06, 09:09 AM
Newbie Coder
Join Date: Sep 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
need help with saving two forms in php
Hi ,
I am new and have 2 forms in html and also i have created database in mysql and the tables in it too ,i have also written the save forms in php for them.But it just gives me a blank page when i click the save button on the forms .
Any help will be really appreciated.
Thanks,
Mallika.
09-20-06, 09:12 AM
Community Leader
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Post your code.
09-20-06, 09:17 AM
Newbie Coder
Join Date: Sep 2006
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
hi
th?
PHP Code:
include "db.php" ;
$aname = $_POST [ 'aname' ];
$adesc = $_POST [ 'adesc' ];
$aaddr = $_POST [ 'aaddr' ];
$cname = $_POST [ 'cname' ];
$caddr = $_POST [ 'caddr' ];
$cph = $_POST [ 'cph' ];
$cfax = $_POST [ 'cfax' ];
$cemail = $_POST [ 'cemail' ];
$hname = $_POST [ 'hname' ];
$haddr = $_POST [ 'haddr' ];
$hph = $_POST [ 'hph' ];
$hfax = $_POST [ 'hfax' ];
$hemail = $_POST [ 'hemail' ];
$ndaward = $_POST [ 'ndaward' ];
if ( $_POST [ 'gr8_ip_1' ]) { $gr8_ip_1 = "on" ; } else { $gr8_ip_1 = "off" ; }
if ( $_POST [ 'gr8_ip_2' ]) { $gr8_ip_2 = "on" ; } else { $gr8_ip_2 = "off" ; }
if ( $_POST [ 'gr8_ip_3' ]) { $gr8_ip_3 = "on" ; } else { $gr8_ip_3 = "off" ; }
if ( $_POST [ 'gr8_ip_4' ]) { $gr8_ip_4 = "on" ; } else { $gr8_ip_4 = "off" ; }
if ( $_POST [ 'gr8_ip_5' ]) { $gr8_ip_5 = "on" ; } else { $gr8_ip_5 = "off" ; }
if ( $_POST [ 'gr8_ip_6' ]) { $gr8_ip_6 = "on" ; } else { $gr8_ip_6 = "off" ; }
if ( $_POST [ 'gr8_ip_7' ]) { $gr8_ip_7 = "on" ; } else { $gr8_ip_7 = "off" ; }
if ( $_POST [ 'gr8_ip_8' ]) { $gr8_ip_8 = "on" ; } else { $gr8_ip_8 = "off" ; }
if ( $_POST [ 'gr8_ip_9' ]) { $gr8_ip_9 = "on" ; } else { $gr8_ip_9 = "off" ; }
if ( $_POST [ 'gr8_ip_10' ]) { $gr8_ip_10 = "on" ; } else { $gr8_ip_10 = "off" ; }
if ( $_POST [ 'gr8_ip_11' ]) { $gr8_ip_11 = "on" ; } else { $gr8_ip_11 = "off" ; }
if ( $_POST [ 'gr8_ip_12' ]) { $gr8_ip_12 = "on" ; } else { $gr8_ip_12 = "off" ; }
if ( $_POST [ 'gr8_tp_1' ]) { $gr8_tp_1 = "on" ; } else { $gr8_tp_1 = "off" ; }
if ( $_POST [ 'gr8_tp_2' ]) { $gr8_tp_2 = "on" ; } else { $gr8_tp_2 = "off" ; }
if ( $_POST [ 'gr8_tp_3' ]) { $gr8_tp_3 = "on" ; } else { $gr8_tp_3 = "off" ; }
if ( $_POST [ 'gr8_tp_4' ]) { $gr8_tp_4 = "on" ; } else { $gr8_tp_4 = "off" ; }
if ( $_POST [ 'gr8_tp_5' ]) { $gr8_tp_5 = "on" ; } else { $gr8_tp_5 = "off" ; }
if ( $_POST [ 'gr8_tp_6' ]) { $gr8_tp_6 = "on" ; } else { $gr8_tp_6 = "off" ; }
if ( $_POST [ 'gr8_tp_7' ]) { $gr8_tp_7 = "on" ; } else { $gr8_tp_7 = "off" ; }
if ( $_POST [ 'gr8_tp_8' ]) { $gr8_tp_8 = "on" ; } else { $gr8_tp_8 = "off" ; }
if ( $_POST [ 'gr8_tp_9' ]) { $gr8_tp_9 = "on" ; } else { $gr8_tp_9 = "off" ; }
if ( $_POST [ 'gr8_tp_10' ]) { $gr8_tp_10 = "on" ; } else { $gr8_tp_10 = "off" ; }
if ( $_POST [ 'gr9_ip_1' ]) { $gr9_ip_1 = "on" ; } else { $gr9_ip_1 = "off" ; }
if ( $_POST [ 'gr9_ip_2' ]) { $gr9_ip_2 = "on" ; } else { $gr9_ip_2 = "off" ; }
if ( $_POST [ 'gr9_ip_3' ]) { $gr9_ip_3 = "on" ; } else { $gr9_ip_3 = "off" ; }
if ( $_POST [ 'gr9_ip_4' ]) { $gr9_ip_4 = "on" ; } else { $gr9_ip_4 = "off" ; }
if ( $_POST [ 'gr9_ip_5' ]) { $gr9_ip_5 = "on" ; } else { $gr9_ip_5 = "off" ; }
if ( $_POST [ 'gr9_ip_6' ]) { $gr9_ip_6 = "on" ; } else { $gr9_ip_6 = "off" ; }
if ( $_POST [ 'gr9_ip_7' ]) { $gr9_ip_7 = "on" ; } else { $gr9_ip_7 = "off" ; }
if ( $_POST [ 'gr9_ip_8' ]) { $gr9_ip_8 = "on" ; } else { $gr9_ip_8 = "off" ; }
if ( $_POST [ 'gr9_ip_9' ]) { $gr9_ip_9 = "on" ; } else { $gr9_ip_9 = "off" ; }
if ( $_POST [ 'gr9_ip_10' ]) { $gr9_ip_10 = "on" ; } else { $gr9_ip_10 = "off" ; }
if ( $_POST [ 'gr9_ip_11' ]) { $gr9_ip_11 = "on" ; } else { $gr9_ip_11 = "off" ; }
if ( $_POST [ 'gr9_ip_12' ]) { $gr9_ip_12 = "on" ; } else { $gr9_ip_12 = "off" ; }
if ( $_POST [ 'gr9_tp_1' ]) { $gr9_tp_1 = "on" ; } else { $gr9_tp_1 = "off" ; }
if ( $_POST [ 'gr9_tp_2' ]) { $gr9_tp_2 = "on" ; } else { $gr9_tp_2 = "off" ; }
if ( $_POST [ 'gr10_ip_1' ]) { $gr10_ip_1 = "on" ; } else { $gr10_ip_1 = "off" ; }
if ( $_POST [ 'gr10_ip_2' ]) { $gr10_ip_2 = "on" ; } else { $gr10_ip_2 = "off" ; }
if ( $_POST [ 'gr10_ip_3' ]) { $gr10_ip_3 = "on" ; } else { $gr10_ip_3 = "off" ; }
if ( $_POST [ 'gr10_ip_4' ]) { $gr10_ip_4 = "on" ; } else { $gr10_ip_4 = "off" ; }
if ( $_POST [ 'gr10_ip_5' ]) { $gr10_ip_5 = "on" ; } else { $gr10_ip_5 = "off" ; }
if ( $_POST [ 'gr10_ip_6' ]) { $gr10_ip_6 = "on" ; } else { $gr10_ip_6 = "off" ; }
if ( $_POST [ 'gr10_ip_7' ]) { $gr10_ip_7 = "on" ; } else { $gr10_ip_7 = "off" ; }
if ( $_POST [ 'gr10_ip_8' ]) { $gr10_ip_8 = "on" ; } else { $gr10_ip_8 = "off" ; }
if ( $_POST [ 'gr10_ip_9' ]) { $gr10_ip_9 = "on" ; } else { $gr10_ip_9 = "off" ; }
if ( $_POST [ 'gr10_ip_10' ]) { $gr10_ip_10 = "on" ; } else { $gr10_ip_10 = "off" ; }
if ( $_POST [ 'gr10_ip_11' ]) { $gr10_ip_11 = "on" ; } else { $gr10_ip_11 = "off" ; }
if ( $_POST [ 'gr10_ip_12' ]) { $gr10_ip_12 = "on" ; } else { $gr10_ip_12 = "off" ; }
$cont = $_POST [ 'cont' ];
$Query = "INSERT INTO form2 VALUES (' $aname ', ' $adesc ', ' $aaddr ', ' $cname ', ' $caddr ', ' $cph ', ' $cfax ', ' $cemail ', ' $hname ', ' $haddr ', ' $hph ', ' $hfax ',' $hemail ', ' $ndaward ', ' $gr8_ip_1 ', ' $gr8_ip_2 ', ' $gr8_ip_3 ', ' $gr8_ip_4 ', ' $gr8_ip_5 ', ' $gr8_ip_6 ', ' $gr8_ip_7 ', ' $gr8_ip_8 ', ' $gr8_ip_9 ', ' $gr8_ip_10 ', ' $gr8_ip_11 ', ' $gr8_ip_12 ', ' $gr8_tp_1 ', ' $gr8_tp_2 ', ' $gr8_tp_3 ', ' $gr8_tp_4 ', ' $gr8_tp_5 ', ' $gr8_tp_6 ', ' $gr8_tp_7 ', ' $gr8_tp_8 ', ' $gr8_tp_9 ', ' $gr8_tp_10 ', ' $gr9_ip_1 ', ' $gr9_ip_2 ', ' $gr9_ip_3 ', ' $gr9_ip_4 ', ' $gr9_ip_5 ', ' $gr9_ip_6 ', ' $gr9_ip_7 ', ' $gr9_ip_8 ', ' $gr9_ip_9 ', ' $gr9_ip_10 ', ' $gr9_ip_11 ', ' $gr9_ip_12 ', ' $gr9_tp_1 ', ' $gr9_tp_2 ', ' $gr10_ip_1 ', ' $gr10_ip_2 ', ' $gr10_ip_3 ', ' $gr10_ip_4 ', ' $gr10_ip_5 ', ' $gr10_ip_6 ', ' $gr10_ip_7 ', ' $gr10_ip_8 ', ' $gr10_ip_9 ', ' $gr10_ip_10 ', ' $gr10_ip_11 ', ' $gr10_ip_12 ', ' $cont ')" ;
$Result = mysql_db_query ( $DBName , $Query );
mysql_close ( $Link );
if ( $Result ) {
print "Data saved correctly" ;
} else {
print "Error Reported on pform2.php<br>" ;
print "SQL: <b> $Query </b><br>" ;
print " $DBName , $Link , $Host <br>" ;
}
?> e code id here :
Last edited by nico_swd; 09-20-06 at 09:20 AM .
09-20-06, 11:04 AM
Community VIP
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
From a syntax standpoint, there is nothing in this code that would prevent it from executing and output one of the if ($Result) {... choices. Either something in the db.php include file is stopping execution or the submit form is not actually causing this PHP code to be executed.
Could you post the db.php file (xxxxxxxx out any sensitive information such as passwords...) and post the form code.
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???
09-21-06, 07:21 AM
Newbie Coder
Join Date: Jan 2006
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Simple method
hi trinity here i give easy methos to this.
in HTML
in PHP
Last edited by nico_swd; 09-21-06 at 07:27 AM .
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes
Linear Mode
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off