Reputation: 227
I am using the code below:
<form>
<textarea cols="50" rows="4" name="link"></textarea>
<textarea cols="50" rows="4" name="notes"></textarea>
<input type="submit" value="Submit">
</form>
It creates two text boxes and I was wondering how to get them from this into a different html file's body code? I think I would need PHP.
At the end I would just want it to display a message saying "Complete" and in a html file e.g code.html in the tags it would have the contents of the two text boxes seperated by one line.
Regards!
Upvotes: 0
Views: 34605
Reputation: 129
you most use php html like this:
echo '<form id="form1" name="form1" method="post" action="">'.
'<p>PASWORD<br>'.
'<input type="text" name="name0" id="text" /><br><br>'.
'<p>BACKLINK<br>'.
'<input type="text" name="name" id="text" />'.
'<br>;'.
'<input type="submit" name="Enter" id="Enter" value="Enter" />'.
'</form>';
and use if for run html
if ($_POST['name0']>''){
your code
}
Upvotes: 2
Reputation: 26380
To accept input one one page and display it on another will require PHP. The general idea:
The HTML form page: Contains you HTML form where the user enters and submits their input. The data from the form is sent to the PHP processing script. We'll assume you use the POST method.
The PHP processing script: Contains code to read the POST values and sanitize them. This means you want to check for HTML you don't want, script tags, etc - anything you don't want. In this case, the user will be displaying this code to themselves, so they can't really harm another user. However, it's something important to keep in mind. The rule of thumb - never trust user input - always check it and clean it. Now that the PHP script has read and cleaned the data, you want to display it.
The PHP display script: Contains the HTML of the page and PHP code to display the values you captured in the PHP processing script.
Other notes: The PHP processing and display scripts can live in the same file. You will have to process before you display. Alternately, you can run the processing script and then include the display script. Both will work.
Upvotes: 0