[PHP-DB] insert form data
Hello list, I am able to get the query to work by itself but it will not work using the if (isset ($submit)) and NO errors are outputting...nothing. Any suggestions would be greatly appreciated. I havnt even gotten to the form variables yet...and yes, my globals are turned on (at least for now). Are there error display holes that I have missed? What am I doing wrong ???... Here's code: ? if (isset ($submit) ) { function showerror() { die(Error . mysql_errno() . : . mysql_error()); } $dbhost = 1.1.1.1; $dbuname = uname; $dbpass = password; $dbname = databasename; $link = mysql_connect ($dbhost, $dbuname, $dbpass) or die (Unable to connect); @mysql_select_db($dbname) or die (Unable to select database); //From other script - this query works but not on this page. $query = INSERT INTO `cust_info` ( `comp_name` , `city` , `state` ) VALUES ('test3', 'test3', 'test3');; if (!mysql_query ($query, $link )) showerror();//nothing echo Here's query: $query;//nothing } else { ? !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN htmlhead title/title/head body center h3Welcome tobrToshiba International CorporationbrCustomer Feedback/center form name=form1 action=survey_index.php method=post table align=center cellpadding=5 tr th colspan=2Please Enter the Information Below and Press the 'Submit' brButton When Finished.br(All Fields Required)/thtrtdnbsp;/td/tr/trtr tdb Company Name: /b/td tdinput type=text name=comp_name size=50/td/tr trtdbCity:/b/td tdinput type=text name=city size=50/td /tr trtdbState:/b/tdtd select name=state size=1 option value=../Choose one option value=alAL option value=akAK /select /td/tr trtdbContact Name: /b/td tdinput type=text name=contact size=50/td/tr /table br table align=center tr td center input type=submit value=Submit /center /form /table /body /html ? } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] insert form data
I am able to get the query to work by itself but it will not work using the if (isset ($submit)) and NO errors are outputting...nothing. That's because $submit is not set Any suggestions would be greatly appreciated. I havnt even gotten to the form variables yet...and yes, my globals are turned on (at least for now). Are there error display holes that I have missed? What am I doing wrong ???... [snip] input type=submit value=Submit Name your form element, so $submit will be set. input type=submit name=submit value=Submit ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] insert form data
Thank you! - you know (darn it!) I had that submit name in the input type on previous test pages - must have forgot it on this one. I'm stressin'... Thanks again On Wed, 2003-01-08 at 13:41, 1LT John W. Holmes wrote: I am able to get the query to work by itself but it will not work using the if (isset ($submit)) and NO errors are outputting...nothing. That's because $submit is not set Any suggestions would be greatly appreciated. I havnt even gotten to the form variables yet...and yes, my globals are turned on (at least for now). Are there error display holes that I have missed? What am I doing wrong ???... [snip] input type=submit value=Submit Name your form element, so $submit will be set. input type=submit name=submit value=Submit ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] insert form data
Uh - excuse me, Me Again... When I post to my next page in the survey in the form action, instead of this page, the data doesnt go into the database. Does anyone know a way around this other than rewriting all the pages into one page? Many thx Mignon On Wed, 2003-01-08 at 13:50, Mignon Hunter wrote: Thank you! - you know (darn it!) I had that submit name in the input type on previous test pages - must have forgot it on this one. I'm stressin'... Thanks again On Wed, 2003-01-08 at 13:41, 1LT John W. Holmes wrote: I am able to get the query to work by itself but it will not work using the if (isset ($submit)) and NO errors are outputting...nothing. That's because $submit is not set Any suggestions would be greatly appreciated. I havnt even gotten to the form variables yet...and yes, my globals are turned on (at least for now). Are there error display holes that I have missed? What am I doing wrong ???... [snip] input type=submit value=Submit Name your form element, so $submit will be set. input type=submit name=submit value=Submit ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] insert form data
When I post to my next page in the survey in the form action, instead of this page, the data doesnt go into the database. Does anyone know a way around this other than rewriting all the pages into one page? Use sessions or hidden form fields to transfer the data between pages. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] insert form data
Actually, I dont need these variables in the rest of the form, I just need to go to the next page...Like a hyperlink on the submit button maybe ??? Seems like I've seen that... Mignon On Wed, 2003-01-08 at 14:12, 1LT John W. Holmes wrote: When I post to my next page in the survey in the form action, instead of this page, the data doesnt go into the database. Does anyone know a way around this other than rewriting all the pages into one page? Use sessions or hidden form fields to transfer the data between pages. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] insert form data
Or a redirect after submitting: Header(Location: pagetogoto.php); ___ Ryan Marrs Web Developer Sandler Travis Trade Advisory Services, Inc. 248.474.7200 x 183 248.474.8500 (fax) www.strtrade.com -Original Message- From: Mignon Hunter [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 08, 2003 3:34 PM To: 1LT John W. Holmes Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] insert form data Actually, I dont need these variables in the rest of the form, I just need to go to the next page...Like a hyperlink on the submit button maybe ??? Seems like I've seen that... Mignon On Wed, 2003-01-08 at 14:12, 1LT John W. Holmes wrote: When I post to my next page in the survey in the form action, instead of this page, the data doesnt go into the database. Does anyone know a way around this other than rewriting all the pages into one page? Use sessions or hidden form fields to transfer the data between pages. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] insert form data
Well change/set the ACTION attribute of your form, then, if that's where you really want to go. The second page should check for if(isset($submit)) and process the data. Or do it in one page and redirect with header() (before _any_ output) after the processing is complete. ---John Holmes... Actually, I dont need these variables in the rest of the form, I just need to go to the next page...Like a hyperlink on the submit button maybe ??? Seems like I've seen that... Mignon On Wed, 2003-01-08 at 14:12, 1LT John W. Holmes wrote: When I post to my next page in the survey in the form action, instead of this page, the data doesnt go into the database. Does anyone know a way around this other than rewriting all the pages into one page? Use sessions or hidden form fields to transfer the data between pages. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] insert form data
Ok - thanks. I've just read up on headers, but, where would you put this in the code? After the submit input type ?? I get an error. On Wed, 2003-01-08 at 14:34, Ryan Marrs wrote: Or a redirect after submitting: Header(Location: pagetogoto.php); ___ Ryan Marrs Web Developer Sandler Travis Trade Advisory Services, Inc. 248.474.7200 x 183 248.474.8500 (fax) www.strtrade.com -Original Message- From: Mignon Hunter [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 08, 2003 3:34 PM To: 1LT John W. Holmes Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] insert form data Actually, I dont need these variables in the rest of the form, I just need to go to the next page...Like a hyperlink on the submit button maybe ??? Seems like I've seen that... Mignon On Wed, 2003-01-08 at 14:12, 1LT John W. Holmes wrote: When I post to my next page in the survey in the form action, instead of this page, the data doesnt go into the database. Does anyone know a way around this other than rewriting all the pages into one page? Use sessions or hidden form fields to transfer the data between pages. ---John Holmes... -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php