Reply to Re: problem while including two scripts...

Your name:

Reply:


Posted by J.O. Aho on 12/29/05 03:42

Leszek wrote:

> // zawiadomienie.php
> <?php
> $tresc1="
> <b>Thanks you entered:<br />
> {$_POST['$title']} {$_POST['$first_name']} {$_POST['$family_name']} <br />
> {$_POST['$gender']} <br />
> {$_POST['$address']} <br />
> {$_POST['$pcode']} {$_POST['$city']} {$_POST['$country']} <br />
> {$_POST['$phone']} <br />
> {$_POST['$fax']}<br />
> {$_POST['$email']}<br />
> Names of accompanying porsons:</b><br /><b><p>";
// we removed the echo "<b><p>";
>
> for ($i=1;$i<=5;$i++){
> $osoba=$_POST["name"."$i"];
> if (strlen($osoba)>0){
//we store the values to the tresc1, no output
> $tresc1.=$osoba."<br>";
> }
> }
//we still want to store everything in the variable
> $tresc1.="</p></b>";
> $tresc2="
> <b>Nowy uczestnik konferencji zarejestrowal sie w bazie danych: </b><br
> /><br />
> Title: <b>{$_POST['$title']}</b> <br />
> Family Name: <b>{$_POST['$family_name']}</b><br />
> First Name: <b>{$_POST['$first_name']}</b><br />
> Gender: <b>{$_POST['$gender']}</b><br />
> Address: <b>{$_POST['$address']}</b> <br />
> Postal Code: <b>{$_POST['$pcode']}</b><br />
> City: <b>{$_POST['$city']}</b><br />
> Country: <b>{$_POST['$country']}</b><br />
> Phone: <b>{$_POST['$phone']}</b><br />
> Fax: <b>{$_POST['$fax']}</b><br />
> Email: <b>{$_POST['$email']}</b><br />
> <br />
> Accompanying persons are:<br /><b>";
// we removed the echo "<b>";
> for ($i=1;$i<=5;$i++){
> $osoba=$_POST["name"."$i"];
> if (strlen($osoba)>0){
//we store the values to the tresc2, no output
> $tresc2.=$osoba."<br>";
> }
> }
//we still want to store everything in the variable
> $tresc2.="</b>";
// as we haven't made any output yet, we will doi it now,
// both $tresc1 and $tresc2
echo $tresc1.$tresc2;
> ?>
> // end of zawiadomienie.php

The rest can be unmodified.

> it worked great until i added two "for" loops in "zawiadomienie.php"

The problem is that you are mixing storage in variables and echo out, you
shouldn't do this, store everything in variables and when finished, then echo
out the stuff.


> and now user who sends data gets on the screen only variables from the both
> "for" loops

This for you store everything else in $tresc1 and $tresc2


> and the one who recives is getting email with all the form variables without
> the ones from the "for" loops

This for you didn't store those values in $tresc1 and $tresc2


//Aho

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация