xkeshav
xkeshav

Reputation: 54084

How to get value from any HTML tag in php variable?

what I am asking is

I have some value in <p>

eg. <p>Hello</p>

now I want to know is there any way to get the value inside <p> in a PHP variable $getPara

(in session variable or normal variable or global variable)

so that when I write <strong><?php echo $getPara; ?></strong> then it will print Hello

Upvotes: 0

Views: 2633

Answers (3)

Gabriele Petrioli
Gabriele Petrioli

Reputation: 196296

if the problem is with input specifically, then you can use

<textarea name="some_name_to_use_in_php">hello</textarea>

Upvotes: 0

Sampson
Sampson

Reputation: 268502

You could look for any element having .includeMe as a class name, and create a form element for it. The next time the form is sent, those items will be sent as values too:

<p class="includeMe" id="state">Georgia</p>

--

$(function(){
  // Everything with class 'includeMe'
  $(".includeMe").each(function(){
    var id   = $(this).attr("id"),
        text = $(this).text(),
        elem = $("<input type='hidden'/>").attr("id", id).val(text);
    // Add to form
    $("form").append(elem);
  });
});

Upvotes: 0

SLaks
SLaks

Reputation: 888283

No, you can't.

The browser will submit all form fields (input, select, and textarea) to the server, but it won't send any other data.

You need to use Javascript.

Upvotes: 1

Related Questions