[PHP] Re: Postnuke Anyone ?
Kirk, Thanx for your help, I've tried with another script and it worked, I successfully retrieved variable content after issueing a POST, I had to add my code after the heather code --- ?php header code ? ?php my code ? ? footer code ? This code simply posts the form and uses javascript to validate form contents before submit. But I still couldn't make my prior code to work, because variable data is not outputed to mysql db, and I'm getting parsing errors. BTW is there a way to know the type of error code is producing ? TIA Cheers, Rick Thanks for your help Ricardo, I have noticed several things from just a quick look at your code: 1. If your not able to post any data/receive any variables from your form when the submit button is clicked, you could have register_globals set to Off. Here is a example form used for that situation: form name=form1 method=post action='?php $_SERVER['PHP_SELF'] ?' centerinput type=submit name=register value=REGISTER Please note that I used $_SERVER instead of PHP_SELF alone, and note the use of the single quotes. This is done when register_globals is turned off, which I have learned is the best way to write your scripts (thanks to the other guys gals on this discussion board). 2. Using if (isset($submit)) { stuff..} is another thing i've been taught to do, rather than if($submit). 3. You haven't given a variable name to your submit button: input type=submit value=Enviar/form give the submit button a name=submit and you will actually have a variable which your script can pick up. Otherwise nothing will happen. HTH, -Kirk Ricardo Fitzgerald [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, I've been unsuccesfully trying to add a php script to a postnuke menu. What I did is a simple form, that connects to a mysql database, and inserts data, then some data is retrieved to generate a page with Welcome $name $lastname ... and so on The problem is the script must be in the center and must include the header, the footer and the left block, I don't understand many things from the way postnuke works, and I couldn't display any variable entered in the form, neither insert data into the db ... I've tried with action=some.php and action=?php PHP_SELF?; so far I only got parsing errors. Any ideas ? Regards, Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Postnuke Anyone ?
How about some code? Here is the code ?php include 'includes/pnAPI.php'; pnInit(); include 'includes/legacy.php'; pnThemeLoad(); # includes the mainfile functions and the header junk if (!isset($mainfile)) { include(mainfile.php); } include(header.php); # When submit starts db connection and inserts data from the form if ($submit) { $db=mysql_connect(localhost, mysql, 10987654321); mysql_select_db(intertur,$db); $sql=INSERT INTO RegistroPersonas (nombre,apellido,pais,email,login_usuario,clave) VALUES ('$nombre','$apellido','$pais','$email','$login_usuario','$clave'); $result=mysql_query($sql); echo Bienvenido $nombre $apellido.\n; } else { #Otherwise starts form input ? pnbsp;nbsp;bINTEGRACION REGIONALbrnbsp;nbsp;LA HACE QUIEN TRABAJAbrbrbrstrongnbsp;nbsp;nbsp;nbsp;TEXTO/strongbr/p brbrbrpnbsp;nbsp;UNIDOS E INTEGRADOSbrnbsp;nbsp;ELEGIMOS NUESTRO DESTINObrbrbrstrongnbsp;nbsp;nbsp;nbsp;TEXTO/b/strongbr/p bh3nbsp;nbsp;Registrarse/h3/bnbsp; table cellpadding=2 cellspacing=1 align=right width=400 style=font-family: tahoma, verdana, arial, helvetica, sans-serif; tr form method=POST action=php? echo $PHP_SELF? tdstrongNombre/strong/td tdstrongApellido/strong/td tdstrongPaiacute;s/strong/td /tr tr tdinput type=text name=nombre size=20 maxlength=25 /td tdinput type=text name=apellido size=20 maxlength=25 /td tdselect name=paisoption value=1Argentina/optionoption value=2Brasil/optionoption value=3Bolivia/optionoption value=4Chile/optionoption value=5Paraguay/optionoption value=6Uruguay/option/select/td /tr tr tdstrongEmail/strong/td tdinput type=text name=email size=20 maxlength=25 /td tdstrongAlias/strong/td /tr tr tdstrongClave/strong/td tdinput type=text name=login_usuario size=20 maxlength=25 /td tdinput type=text name=clave size=20 maxlength=25 /td /tr tr tdstrongRepita la Clave/strong/td tdinput type=text name=repclave size=20 maxlength=25 /td td/td /tr tr tdstrongSexo/strong/td tdinput type=radio name=sexo value=masculino masculinobr input type=radio name=sexo value=femenino femenino/td tdstrongFecha de Nacimiento/strong/td /tr tr tdnbsp;/td tdnbsp;input type=submit value=Enviar/form/td tdnbsp;/td /tr /table ?php } ? ?php // include footer junk include(footer.php); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Postnuke Anyone ?
Ricardo, I have noticed several things from just a quick look at your code: 1. If your not able to post any data/receive any variables from your form when the submit button is clicked, you could have register_globals set to Off. Here is a example form used for that situation: form name=form1 method=post action='?php $_SERVER['PHP_SELF'] ?' centerinput type=submit name=register value=REGISTER Please note that I used $_SERVER instead of PHP_SELF alone, and note the use of the single quotes. This is done when register_globals is turned off, which I have learned is the best way to write your scripts (thanks to the other guys gals on this discussion board). 2. Using if (isset($submit)) { stuff..} is another thing i've been taught to do, rather than if($submit). 3. You haven't given a variable name to your submit button: input type=submit value=Enviar/form give the submit button a name=submit and you will actually have a variable which your script can pick up. Otherwise nothing will happen. HTH, -Kirk Ricardo Fitzgerald [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, I've been unsuccesfully trying to add a php script to a postnuke menu. What I did is a simple form, that connects to a mysql database, and inserts data, then some data is retrieved to generate a page with Welcome $name $lastname ... and so on The problem is the script must be in the center and must include the header, the footer and the left block, I don't understand many things from the way postnuke works, and I couldn't display any variable entered in the form, neither insert data into the db ... I've tried with action=some.php and action=?php PHP_SELF?; so far I only got parsing errors. Any ideas ? Regards, Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Postnuke Anyone ?
How about some code? Ricardo Fitzgerald [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi, I've been unsuccesfully trying to add a php script to a postnuke menu. What I did is a simple form, that connects to a mysql database, and inserts data, then some data is retrieved to generate a page with Welcome $name $lastname ... and so on The problem is the script must be in the center and must include the header, the footer and the left block, I don't understand many things from the way postnuke works, and I couldn't display any variable entered in the form, neither insert data into the db ... I've tried with action=some.php and action=?php PHP_SELF?; so far I only got parsing errors. Any ideas ? Regards, Rick -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php