PHP: Manipulating data a user inputs into a browser -
i user able input data in text field on website. data them able manipulate it.
for example:
let's needs letters in paragraph capitalized , on website have php script that. how create means them use script?
like so:
- paste paragraph left text field
- press 'action button' or in example 'capitalize letters' button
- text in left text field gets ran through script , becomes capitalized
- text appears in right text field
a better way ask guess how connect users input script , display output once it's been ran?
you have put fields in form in html file, example this:
<form method="post" action="script_that_does_the_action.php"> left paragraph: <input type="text" id="leftp" name="leftp"><br> right paragraph: <input type="text" id="rightp" name="rightp"> </form>
and in script of action, can fetch user input this:
$userinput = $_post['leftp']; //do capitalization here //store result somehow. maybe using sessions this: $_session["result"]; //then have redirect page text fields example using header("location: ");
and in index page (if may call that), paste resulting value right field:
<input type="text" id="rightp" name="rightp" value="<?php echo $_session["result"]; ?>">
be sure both of files (the action script , index file) in .php format, , start session session_start();
that's 1 example...the basic one. if want make in proper way, i'd suggest using javascript :)
Comments
Post a Comment