1

I have an HTML form with three fields, first name surname and mid. name and I want to save this information in a php page. The problem is I don't know how to save multiple entries in array without a connection of database.

HTML form

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Εργασία 11 - Βασίλης Τρίγκας</title>
    </head>
    <body>
        <h4>Καταχώριση βιβλίου</h4>
        <form action="form_action.php" method="get">
            Συγγραφέας <br/><input type="text" name="fnwriter" /><br/>
            Τίτλος <br/><input type="text" name="title" /><br/>
            Εκδότης<br/> <input type="text" name="editor" /><br />
            <input type="submit" value="Submit" />
        </form>

    </body>
</html>

PHP File

    <?php 

function display_welcome(){
    print("Σωστή εισαγωγή,  ");
    print($_GET['fnwriter','title','editor'])
}

function display_empty_form(){
    print <<<_HTML_
    <FORM method="post" action="$SERVER['PHP_SELF']">
    <BR/>
    <INPUT type="submit" value="SUBMIT NAME">
    </FORM>
    _HTML_;
}

if ($_GET['fnwriter','title']) {
    display_welcome();
}
else {
    display_empty_form();
}

$Book=array("fnwriter","title","editor");

$fwriter=$_GET['$fnwriter']
$title=$_GET['$title']
$editor=$_GET['$editor']

echo $fnwriter;
echo $title;
echo $editor;

for ($i = 0; $i < count($fnwriter,$title,$editor); ++$i) {
        echo "Book $i= $fnwriter[$i],$title[$i],$editor[$i]<br />";
    }

//echo $Book[$_GET];
//print_r($);
?>
3
  • Well, what do you want to do with the information? Save it to a file? Commented Dec 14, 2010 at 13:48
  • And where do you intend on putting this array once you've "saved" the entries in it? Commented Dec 14, 2010 at 13:48
  • AGGGH MY EYES!!! print($_GET['fnwriter','title','editor']) Commented Dec 14, 2010 at 18:11

1 Answer 1

1

I don't really get your question, is that about saving data to a file, or about processing $_POST data?

If it's the first one, you have a plenty of possibilities, from simple CSV (or any other separator) to XML ;)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.