Skip to content Skip to sidebar Skip to footer

Php - Accessing Span Values

I'm new to PHP but I'm working on an email script for an order form. I have all the values and what not in a form, with a text element that is span-ned for javascript access client

Solution 1:

You can't do that. The POST array will only contain what you post via input fields. Easiest thing for you to do would be to have some hidden inputs with your values in them

<inputtype="hidden" name="prices[0]" value ="11.99">
<inputtype="hidden" name="prices[1]" value ="11.99">
<inputtype="hidden" name="prices[2]" value ="11.99">

This will be available in your $_POST array. You can access it like

$value1 = $_POST['prices'][0];

Or just iterate it through as an array

Solution 2:

You can't. You'll have to add some hidden inputs, and modify them from Javascript, to get them server-side. PHP can't access to the HTML, and only inputs elements are posted.

Post a Comment for "Php - Accessing Span Values"