2016-11-22 1 views
-1

Hi Ich frage mich, wie Sie nehmen könnten, was in einem Textfeld geschrieben ist und replizieren Sie es dann auf eine separate HTML-Seite. Ähnlich wie hier beim Stack-Overflow, wie etwas geschrieben, gepostet und dann angezeigt wird.Wie man nimmt, was geschrieben wird auf <textarea> und replizieren Sie es dann auf eine separate html Seite

Ein Beispiel für den Textbereich und Submit-Button Example

Ein Beispiel für den Code (für das Textfeld)

<form class="pryform" form action="phpfile.php"> 
    <div class="form-group"> 
     <label for="exampleInputName1">Name (optional, will be displayed)</label> 
     <textarea class="form-control" id="prnform" placeholder="Name" rows="1"></textarea> 
    </div> 
     <div class="form-group"> 
     <label for="exampleInputDescription1">Description</label> 
     <textarea class="form-control" id="prdform" placeholder="Description" rows="3"></textarea> 
    </div> 
     <button type="submit" class="btn btn-default" id="button" data-text-loading="Loading...">Submit</button> 
</form> 

Und dann ein Beispiel das, was kommen soll:

Example

Danke

+0

Meinst du eine "Blogging" -Website, auf der du Sachen posten kannst? – paolobasso

+1

So wie Sie es mit jedem anderen Eingabefeld tun – RiggsFolly

+0

Es funktioniert wie andere Eingabe-Tags. –

Antwort

0

Versuchen Sie etwas wie das. Formularseite:

<form method="get" class="pryform" form action="phpfile.php"> 
    <div class="form-group"> 
    <label for="exampleInputName1">Name (optional, will be displayed)</label> 
    <textarea class="form-control" name="exampleInputName1" id="prnform" placeholder="Name" rows="1"></textarea> 
    </div> 
    <div class="form-group"> 
    <label for="exampleInputDescription1">Description</label> 
    <textarea class="form-control" name="exampleInputDescription1" id="prdform" placeholder="Description" rows="3"></textarea> 
    </div> 
    <button type="submit" class="btn btn-default" id="button" name="submit" data-text-loading="Loading...">Submit</button> 
</form> 

und die phpfile.php:

<?php 

if (isset($_GET['submit'])) { 
    echo $_GET['exampleInputName1'] . "<br />"; 
    echo $_GET['exampleInputDescription1']; 
} 

?> 
+0

Vielen Dank, ausgezeichnete Antwort hat gut funktioniert! – TreyT

0

Sie haben ein name für Ihr Textfeld angeben. Zum Beispiel:

<textarea class="form-control" id="prnform" placeholder="Name" rows="1" name="name"></textarea> 

und

<textarea class="form-control" id="prdform" placeholder="Description" rows="3" name="description"></textarea> 

Dann können Sie sie Zugang in phpfile.php als $_GET['name'] und $_GET['description']

<h2><?= $_GET['name'] ?></h2> 
<h1><?= $_GET['description'] ?></h1> 
0

HTML-Code: -

<form action="" method="post"> 
<textarea name="text" placeholder="enter the text here..."></textarea> 
<input type="submit" name="submit" value="click here"> 
</form> 

php code: -

<?php 
if(isset($_POST["submit"])){ 
echo $_POST["text"]; 
} 
?> 
Verwandte Themen