php-script ontvangt geen waarden

Status
Not open for further replies.

Johan_Derks

Verified User
Joined
May 8, 2011
Messages
10
Ik hoopte op eigen kracht mijn eerste php-script te kunnen schrijven, maar dat valt tegen. Mijn html-pagina "pagoproceduro" verstuurt een formulier met POST naar action=""pagoreguligo.php", maar de mails, die pagoreguligo ermee maakt, hebben kennelijk geen waarden van het formulier ontvangen.
De twee bestanden ztten in dezelfde map op mijn server.

Script 'pagoproceduro' (mijn voertaal is Esperanto !):
<html>
<!-- Created on: 10-7-2011 -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>retposhta reago</title>

<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
mso-layout-grid-align:none;
text-autospace:none;
font-size:10.5pt;
font-family:"Trebuchet MS";
mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Trebuchet MS";}
-->
</style>

<meta name="description" content="">
<meta name="keywords" content="">
<meta name="author" content="Unregistered User">
<meta name="generator" content="AceHTML Freeware">

<script language="Javascript" type="text/javascript">
<!--
function kashu()
{document.getElementById('konto1').style.visibility="hidden";
document.getElementById('konto2').style.visibility="hidden";
}
// -->
</script>

<script language="Javascript" type="text/javascript">
<!--
function malplenigu(x)
{document.getElementById(x).value="";
}
// -->
</script>

<script language="Javascript" type="text/javascript">
<!--
function valida()
{if (pago.famnomo.value=="familia nomo" || pago.famnomo.value=="" )
{alert("Enigu vian familian nomon !"); return false;}
if (pago.persnomo.value=="persona nomo" || pago.persnomo.value=="")
{alert("Enigu vian personan nomon !"); return false;}
if (pago.pagoproceduro[1].checked && pago.kontokodo.value=="")
{alert("Enigu vian kontokodon !"); return false;}
if (pago.retposhto.value=="")
{alert("Enigu vian retposhtadreson !"; return false}
}
// -->
</script>

<script language="Javascript" type="text/javascript">
<!--
function adresghust()
{if (pago.retposhto.value.indexOf("@")==-1)
{alert("Chi-tiu adreso ne ghustas");}
}
// -->
</script>

</head>
<body onload="kashu()">

<form name="pago" action="pagoreguligo.php" method="post"
onsubmit="return valida();" enctype="text/plain" mailto:>

<div><font size="-1">Al la sekcio 'financoj' de UEA<br><br>
Bonan tagon !<br><br>
Mi, <input type="text" name="famnomo" size="20" maxlength="30" value="familia nomo"
onfocus="malplenigu(this.id)" id="f">
<input type="text" name="persnomo" size="20" maxlength="30" value="persona nomo"
onfocus="malplenigu(this.id)" id="p">
petas vin</font> <font size="-5">(<i>elektu</i>)</font><br><br>
</div>

<table>
<tr>
<td><input type="radio" name="pagoproceduro" value="konto"
onclick="document.getElementById('konto1').style.visibility='visible'
document.getElementById('konto2').style.visibility='visible'
document.getElementById('malfermo').style.visibility='hidden'">
</input></td>
<td align=left colspan=2><font size="-1">pagi du eŭrojn el mia konto</font></td>
<td><div id="konto1" valign="center">
<input type="text" name="kontokodo" size="3" maxlength="6"></input>
</div></td>
</tr>
<tr>
<td></td>
<td align=left colspan=3><div id="konto2">
<font size="-1">al la konto idoj-p kun mencio "Cirkulaĵo RF, somero 2011".</font>
</div></td>
</tr>
<tr>
<td><input type="radio" name="pagoproceduro" value="malfermo" checked=true
onclick="document.getElementById('malfermo').style.visibility='visible'
document.getElementById('konto1').style.visibility='hidden'
document.getElementById('konto2').style.visibility='hidden'">
</td>
<td colspan=3><font size="-1">malfermi konton je mia nomo</font><br></td>
</tr>
<tr>
<td> </td>
<td align=left colspan=3><div id="malfermo">
<font size="-1">kaj tuj post enmeto de minimume dek eŭroj
debeti ĝin je du eŭroj<br> kredite al la konto idoj-p
kun mencio "Cirkulaĵo RF, somero 2011".</font></div>
</td>
</tr>
<tr>
<td></td>
<td align=left><br><font size="-1">Mia retpoŝtadreso estas</font></td>
<td colspan=2><br><input type="text" name="retposhto" size="50" maxlength="60"
onchange="adresghust()"></input></td>
</tr>
<tr>
<td align=center valign=bottom colspan=4><br><a href="">
<input type="submit" value="Sendu"></a>
</td>
</tr>
</table>
</form>
</body>
</html>

Script 'pagoreguligo.php':
<?php /* Kreita je: 12-7-2011 */
ini_set('display_errors',1);
error_reporting(E_ALL&~E_NOTICE);
define('TITLE','Register');
$body="Bonan tagon !
Al la sekcio 'financoj' de UEA \r\n";
echo $famnomo;
$body=$body . $famnom;
echo $body;
// strtoupper($_POST['famnomo']) . " " . ucwords(strtolower($_POST['persnomo'])) . ", petas vin \r\n";
if($_POST['pagoproceduro']=='konto')
{$plu="pagi du eurojn el mia konto {$_POST['kontokodo']} \r\n
al la konto idoj-p kun mencio 'Cirkulajho RF, somero 2011.'";}
else {$plu="malfermi konton je mia nomo kaj tuj post enmeto de minimume dek euroj
debeti ghin je du euroj \r\n kredite al la konto idoj-p
kun mencio 'Cirkulajho RF, somero 2011'.";}
mail("[email protected]","pago por Cirkulajho RF, somero 2011", $body,
"From: {$_POST['retposhto']} \r\n Cc: [email protected] \r\n Bcc: [email protected]");
?>

Ik hoop, dat iemand mij wil helpen.
 
php-script does not receive values from html-script

I repeat the whole of my message in English now:
________________________________________
I hoped to succeed in writing my first serious php-script flawless, but it seems to be not that easy. My html-page "pagoproceduro" sends a form by POST to action=""pagoreguligo.php", but the mails, who pagoreguligo produces from it, apparently did not receive any values from the form.
The two files are in the same directory in my server.

Script 'pagoproceduro' (my language of communication is Esperanto !):
<html>
<!-- Created on: 10-7-2011 -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>retposhta reago</title>

<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
mso-layout-grid-align:none;
text-autospace:none;
font-size:10.5pt;
font-family:"Trebuchet MS";
mso-fareast-font-family:"Times New Roman";
mso-bidi-font-family:"Trebuchet MS";}
-->
</style>

<meta name="description" content="">
<meta name="keywords" content="">
<meta name="author" content="Unregistered User">
<meta name="generator" content="AceHTML Freeware">

<script language="Javascript" type="text/javascript">
<!--
function kashu()
{document.getElementById('konto1').style.visibility="hidden";
document.getElementById('konto2').style.visibility="hidden";
}
// -->
</script>

<script language="Javascript" type="text/javascript">
<!--
function malplenigu(x)
{document.getElementById(x).value="";
}
// -->
</script>

<script language="Javascript" type="text/javascript">
<!--
function valida()
{if (pago.famnomo.value=="familia nomo" || pago.famnomo.value=="" )
{alert("Enigu vian familian nomon !"); return false;}
if (pago.persnomo.value=="persona nomo" || pago.persnomo.value=="")
{alert("Enigu vian personan nomon !"); return false;}
if (pago.pagoproceduro[1].checked && pago.kontokodo.value=="")
{alert("Enigu vian kontokodon !"); return false;}
if (pago.retposhto.value=="")
{alert("Enigu vian retposhtadreson !"; return false}
}
// -->
</script>

<script language="Javascript" type="text/javascript">
<!--
function adresghust()
{if (pago.retposhto.value.indexOf("@")==-1)
{alert("Chi-tiu adreso ne ghustas");}
}
// -->
</script>

</head>
<body onload="kashu()">

<form name="pago" action="pagoreguligo.php" method="post"
onsubmit="return valida();" enctype="text/plain" mailto:>

<div><font size="-1">Al la sekcio 'financoj' de UEA<br><br>
Bonan tagon !<br><br>
Mi, <input type="text" name="famnomo" size="20" maxlength="30" value="familia nomo"
onfocus="malplenigu(this.id)" id="f">
<input type="text" name="persnomo" size="20" maxlength="30" value="persona nomo"
onfocus="malplenigu(this.id)" id="p">
petas vin</font> <font size="-5">(<i>elektu</i>)</font><br><br>
</div>

<table>
<tr>
<td><input type="radio" name="pagoproceduro" value="konto"
onclick="document.getElementById('konto1').style.visibility='visible'
document.getElementById('konto2').style.visibility='visible'
document.getElementById('malfermo').style.visibility='hidden'">
</input></td>
<td align=left colspan=2><font size="-1">pagi du eŭrojn el mia konto</font></td>
<td><div id="konto1" valign="center">
<input type="text" name="kontokodo" size="3" maxlength="6"></input>
</div></td>
</tr>
<tr>
<td></td>
<td align=left colspan=3><div id="konto2">
<font size="-1">al la konto idoj-p kun mencio "Cirkulaĵo RF, somero 2011".</font>
</div></td>
</tr>
<tr>
<td><input type="radio" name="pagoproceduro" value="malfermo" checked=true
onclick="document.getElementById('malfermo').style.visibility='visible'
document.getElementById('konto1').style.visibility='hidden'
document.getElementById('konto2').style.visibility='hidden'">
</td>
<td colspan=3><font size="-1">malfermi konton je mia nomo</font><br></td>
</tr>
<tr>
<td> </td>
<td align=left colspan=3><div id="malfermo">
<font size="-1">kaj tuj post enmeto de minimume dek eŭroj
debeti ĝin je du eŭroj<br> kredite al la konto idoj-p
kun mencio "Cirkulaĵo RF, somero 2011".</font></div>
</td>
</tr>
<tr>
<td></td>
<td align=left><br><font size="-1">Mia retpoŝtadreso estas</font></td>
<td colspan=2><br><input type="text" name="retposhto" size="50" maxlength="60"
onchange="adresghust()"></input></td>
</tr>
<tr>
<td align=center valign=bottom colspan=4><br><a href="">
<input type="submit" value="Sendu"></a>
</td>
</tr>
</table>
</form>
</body>
</html>

Script 'pagoreguligo.php':
<?php /* Kreita je: 12-7-2011 */
ini_set('display_errors',1);
error_reporting(E_ALL&~E_NOTICE);
define('TITLE','Register');
$ekalparolo="Bonan tagon !
Al la sekcio 'financoj' de UEA \r\n";
$donitajhoj="Mi, ".strtoupper($famnomo)." ".ucwords(strtolower($persnomo)).", petas vin \r\n";
if($pagoproceduro=='konto')
{$peto="pagi du eurojn el mia konto {$_POST['kontokodo']} \r\n
al la konto idoj-p kun mencio 'Cirkulajho RF, somero 2011.'";}
else
{$peto="malfermi konton je mia nomo kaj tuj post enmeto de minimume dek euroj \r\n
debeti ghin je du euroj kredite al la konto idoj-p kun mencio 'Cirkulajho RF, somero 2011'.";}
$body=$ekalparol.$donitajhoj.$peto;
mail("[email protected]","pago por Cirkulajho RF, somero 2011", $body,
"From: $retposhto \r\n Cc: [email protected] \r\n Bcc: [email protected]");
?>

register_globals is on.
I hope, somebody is willing to help me.
 
This scripts looks for me to a 'php spam' script.
If i'm wrong then write a better question and also better code

'register_globals' should be 'off' also ;)
 
It looks like a contact form. First generated by AceHTML Freeware as it says in the meta tag. Then he tried to catch the form data in php to send it to his e-mail, but it's not working because he isn't setting the variables correct.
Its just one big mess. You should hire someone or get a php book or read tutorials.
 
Thank you SeLLeRoNe ! I am glad you are not 'Jeff'.
For those who understand that not all users here have English as their native language and not all have a job or studied in programming, I want to specify what is my aim.
Like Arieh understood, it is a contact form, but the reader gets it, when trying to open a number of a bulletin, whose editor I am.
Up to know the bulletin is for free, but I think, it should cost two euro's. So when clicking it sends to www.esp-evoluo.org, where my contactform is stalled.
I used mailheaders in the way they are used in Larry Ullmans book 'PHP voor het WWW'. It seems they are not correctly initialised or don't have the right order, but the book does not say anything about that. Also looking for $headers on internet dit not take me further.
The email which 'pagoproceduro' tries to compose should be sent to the treasurer (a request to pay two euro's out of his/her account or to open an account and to take out, after funding, two euro's) with a BCC to me and a copy to the forwarder him/herself.

Probably to many the code of my html-page looks terribly awkward, but in my computer it does what I asked it to do.
I am glad this forum exists, even though not all users are very tolerant.

As register_globals is 'on', I was advised to put it 'off'. The server does not show its ini.php and also I don't know how to write an ini.set-program.
Nevertheless I changed all globals already into superglobals, so that the php-program now reads:

<?php /* Kreita je: 12-7-2011 */
ini_set('display_errors',1);
error_reporting(E_ALL&~E_NOTICE);
define('TITLE','Register');
$body="Bonan tagon !
Al la sekcio 'financoj' de UEA \r\n";
echo $famnomo;
$body=$body . $famnom;
echo $body;
// strtoupper($_POST['famnomo']) . " " . ucwords(strtolower($_POST['persnomo'])) . ", petas vin \r\n";
if($_POST['pagoproceduro']=='konto')
{$plu="pagi du eurojn el mia konto {$_POST['kontokodo']} \r\n
al la konto idoj-p kun mencio 'Cirkulajho RF, somero 2011.'";}
else {$plu="malfermi konton je mia nomo kaj tuj post enmeto de minimume dek euroj
debeti ghin je du euroj \r\n kredite al la konto idoj-p
kun mencio 'Cirkulajho RF, somero 2011'.";}
mail("[email protected]","pago por Cirkulajho RF, somero 2011", $body,
"From: {$_POST['retposhto']} \r\n Cc: [email protected] \r\n Bcc: [email protected]");
?>
 
Im based on your reply and on your post my ideas that was spam or something malicious.

Im not english native language aswell.

Sorry if i thot you was a kind of bot/spammer but that happend.

The main reason of this is cause this is a Forum dedicated to DirectAdmin users, most of post here are related to problem with directadmin and servers and each user try to help each other on solve those problem.

This is not an official support forum for directadmin and or php programming so maybe you will find better solution elsewhere or with google.

Im not a programmer so, i cant help you and im sorry, perhaps, someone else with more programming skills would try to help you.

Regards
 
Like SeLLeRoNe says, this forum is only meant for DirectAdmin discussions only.

Try looking for a php scripting or webmaster forum where problems similar like yours are being discussed. I'm sure there are enough forums for this in any language.

To point you in the right direction: PHP works from top to bottom. POST data is only in the $_POST variable array (and $_REQUEST) until you put it in something else.

You try to echo "$famnomo" and "$famnom", but they're not declared. I see that you have a input named famnomo. To get the text someone typed in that input into $famnomo, you need to do $famnomo = $_POST['famnomo'];

To solve problems like this you need to debug; try this for example:

print_r($_POST);

This way you can see everything that is in the array $_POST.

This is the last thing I say on this subject, please find another forum.
 
This is not a programming website at all...so not sure why this was even posted here.
 
farewell

Okay, thanks everybody, especially SeLLeRoNe and Arieh.
I am now on a Dutch php-script forum.
 
Whereas I never saw any reason to consider the user a spammer, and block him or the thread, I do think it's now time to close it :).

Jeff
 
Status
Not open for further replies.
Back
Top