PDA

Volledige versie bekijken : Enter in gastenboek


r_zwijgers
%Europe/Berlin %533 %2006, 12:48
Ik heb het volgende

een dynamic text field. Nu is het zo dat als ik een bericht daar in typ en hem verzend via php zo dat hij in beeld komt voor anderen. Dat hij alles achter elkaar zet. Dus als ik een Enter (dus nieuwe regel) wil beginnen gaat hij gewoon aan 1 stuk door. Wat moet ik veranderen in mijn php?

Zo is hij nu:

<?php
// If you are using an old version of php, remove the next set of lines.
// or use $HTTP_POST_VARS["..."] instead.
$Submit = $_POST["Submit"];
$Name = $_POST["Name"];
$Email = $_POST["Email"];
$Website = $_POST["Website"];
$Comments = $_POST["Comments"];
$NumLow = $_REQUEST["NumLow"];
$NumHigh = $_REQUEST["NumHigh"];

// Replace special characters - you can remove the next 5 lines if wanted.
$Name = ereg_replace("[^A-Za-z0-9 ]", "", $Name);
$Email = ereg_replace("[^A-Za-z0-9 \@\.\-\/\']", "", $Email);
$Comments = ereg_replace("[^A-Za-z0-9 \@\.\-\/\']", "", $Comments);
$Website = eregi_replace("http://", "", $Website);
$Website = ereg_replace("[^A-Za-z0-9 \@\.\-\/\'\~\:]", "", $Website);

// Remove slashes.
$Name = stripslashes($Name);
$Email = stripslashes($Email);
$Website = stripslashes($Website);
$Comments = stripslashes($Comments);

// ################################################## #################################
// ########## Reading and Writing the new data to the GuestBook Database #############

if ($Submit == "Yes") {
// Next line tells the script which Text file to open.
$filename = "GuestBook.txt";

// Opens up the file declared above for reading

$fp = fopen( $filename,"r");
$OldData = fread($fp, 80000);
fclose( $fp );

// Gets the current Date of when the entry was submitted
$Today = (date ("l dS of F Y ( h:i:s A )",time()));

// Puts the recently added data into html format that can be read into the Flash Movie.
// You can change this up and add additional html formating to this area. For a complete listing of all html tags
// you can use in flash - visit: http://www.macromedia.com/support/flash/ts/documents/htmltext.htm

$Input = "Geplaatst op: <b>$Name</b><br>Onderwerp: <b>$Email</b><br>Bericht: <br><b>$Comments</b><br><br>";

/* This Line adds the '&GuestBook=' part to the front of the data that is stored in the text file. This is important because without this the Flash movie would not be able to assign the variable 'GuestBook' to the value that is located in this text file */

$New = "$Input$OldData";

// Opens and writes the file.

$fp = fopen( $filename,"w");
if(!$fp) die("&GuestBook=cannot write $filename ......&");
fwrite($fp, $New, 800000);
fclose( $fp );
}

// ################################################## #################################
// ######### Formatting and Printing the Data from the Guestbook to the Flash Movie ##



// Next line tells the script which Text file to open.
$filename = "GuestBook.txt";

// Opens up the file declared above for reading

$fp = fopen( $filename,"r");
$Data = fread($fp, 800000);
fclose( $fp );

// Splits the Old data into an array anytime it finds the pattern .:::.
$DataArray = split (".:::.", $Data);

// Counts the Number of entries in the GuestBook
$NumEntries = count($DataArray) - 1;

print "&TotalEntries=$NumEntries&NumLow=$NumLow&NumHigh=$NumHigh&GuestBook=";
for ($n = $NumLow; $n < $NumHigh; $n++) {
print $DataArray[$n];
if (!$DataArray[$n]) {
Print "<br></b>";
exit;
}
}
?>

Macs
%Europe/Berlin %575 %2006, 13:48
Heb je voor het textfield in Flash wel html aan staan?

theFlashWizard
%Europe/Berlin %589 %2006, 14:08
kun je even de php tags op het forum gebruiken aub, dat maakt het wat overzichtelijker :)
[Guide] Voordat je post (http://www.flashfocus.nl/forum/showthread.php?t=7649)
met wat voor script verstuur je het vanuit flash?

r_zwijgers
%Europe/Berlin %712 %2006, 17:06
Hier de flash en php file die ik gebruik (en dan natuurlijk nog een .txt bestandje)

Let niet op wat het is nog een rotzooitje kwa opzet. Heb heb van een standaar voorbeeld genomen en dat helemaal veranderd vandaar. En ben zo als al wel duidelijk geen ervaren flash en php gebruiker.

Hoop dat je uit de bestandjes kunt halen hoe ik het op kan lossen

Bedankt!

Macs
%Europe/Berlin %730 %2006, 17:31
krijg je de tags wel te zien in je tekstveld of loopt de tekst gewoon door zonder de tags?

r_zwijgers
%Europe/Berlin %735 %2006, 17:39
het gaat me erom dat vb:

Als ik een verhaal typ zo als nu
hij dan ook zo word weer gegeven
met eventueel een opsomming
1. lldfld
2. dallds
3. ldlafj

en niet dat hij het zo doet:

Als ik een verhaal typ zo als nu hij dan ook zo word weer gegeven met eventueel een opsomming 1. lldfld 2. dallds 3. ldlafj

Dat is dus het probleem wat hij nu doet, hij zet alle tekst die ik typ in het dynimac tekst field voor het bericht (dus niet geplaats op of onderwerp) gewoon allemaal achter elkaar

Hoop dat ik het zo duidelijk genoeg uitleg?

Macs
%Europe/Berlin %560 %2006, 13:27
print "&TotalEntries=$NumEntries&NumLow=$NumLow&NumHigh=$NumHigh&GuestBook=";
for ($n = $NumLow; $n < $NumHigh; $n++) {
print $DataArray[$n];
if (!$DataArray[$n]) {
Print "<br></b>";
exit;


dit staat onderaan je script.
Hie moet je de data opmaak mee printen, want dat doe je niet...
probeer:

print "&TotalEntries=$NumEntries&NumLow=$NumLow&NumHigh=$NumHigh&GuestBook=";
for ($n = $NumLow; $n < $NumHigh; $n++) {
print "<b>".$DataArray[$n]."</b><br>";
if (!$DataArray[$n]) {
print "<br></b>";


en t moet goed gaan

;)

r_zwijgers
%Europe/Berlin %648 %2006, 15:33
nee helaas is het daardoor niet opgelost!
Iemand anders hulp?

Macs
%Europe/Berlin %652 %2006, 15:40
wat is de volledige url van GuestBook.php ?
(of heb je m alleen lokaal?)

r_zwijgers
%Europe/Berlin %714 %2006, 17:09
als je bestanden download hierboven zo heb ik hem of bedoel e anders?