I am working on a university project in which I have made an admin panel from which I can write/edit "Rules" for university students like
"No student is allowed to have cell-phone in class"
well I have made a <p>
element in which 1 rule is written(at the time of designing), I want to change it dynamically using php.
the problem is, I didn't find any method or logic to get text of that p element and then place it in
<textarea>
so that I can change that rule by editing text in textarea and then update it.
Here is the HTML Code which I am using to add/update a rule.
<form class="form-horizontal">
<div class="form-group">
<label for="txt_rule" class="control-label col-sm-3">Rule Description</label>
<div class="col-sm-6">
<textarea id="txt_rule" class="form-control" name="txt_rule" rows="3" value="" placeholder="Add or Update New Rules"></textarea>
</div>
</div>
<div class="form-group">
<div class=" col-sm-offset-3 col-sm-6">
<button class="btn btn-info btn-sm" name="addNewRule" value="">Add New Rule</button>
<button class="btn btn-primary btn-sm" name="update" value="">Update</button>
</div>
</div>
</form>
Here is the HTML code which I have designed at time to coding and want to change that p element in it.
<div class="rule col-sm-12">
<div class="rulenNumber">1</div>
<p>Rule Description will be written here.</p>
<a href="#" class="btn btn-danger btn-sm pull-right" >Delete</a>
<a href="#" class="btn btn-info btn-sm pull-right" >Update</a>
</div>
I want to get text of p element in my textarea using php, so that I can modify it at any time.
element then i can store it .
– Hassan Raza Oct 12 '16 at 06:57element. Imagine, if this rule would be saved in a database, you just can do a simple query and you can place the text of this rule whereever you want! Press update->query->load data, display it
– Twinfriends Oct 12 '16 at 07:54