Get inner html with php

I started learning php and I came accross this issue. I have the html code in my form:

<label for="u">Usability <span id='u_score'>0</span> / 7</label>

I want to get the inner html of the span with id u_score. How do I do this in php? Any help would be appreciated.

I have already tried

$u_score = $_POST["u_score"];

but that returns undefined because there is no value associated with the span.

Thank you


What you can do is to copy the span text content into a hidden input which will be posted:

<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
    function copySpanContent() {
    document.getElementById("u_score_value").value =
<form method="POST" action="PHPSCRIPT.php" onsubmit="copySpanContent()">
<label for="u">Usability <span id='u_score'>0</span> / 7</label>
<input type="hidden" name="u_score_value" id="u_score_value">
<button type="submit">submit</button>

Then you can get the value from PHP with $_POST['u_score_value'].

Need Your Help

Nested closures does not like argument list

uiview swift closures uianimation completionhandler

A UIView needs to change a warning label depending on the completion handler of a custom control:

Pasing A KeyValuePair In A For Loop

How do I pass an entire KeyValuePair to a For Loop?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.