Norah
Norah

Reputation: 105

get label value php

I am trying to get the label value here :

<form action="doinsert.php" method="post" enctype="multipart/form-data"> 
    <input name="buttonExecute" onClick="execute(document.getElementById('id_student').value)" type="button" value="CHECK  AVAILBLITY" />
    <label name="lab" id="idhere"  ></label></p>
    <input type="hidden"   name="val" value="<?php echo $_POST['lab']; ?>"  />
    <input type="submit" name="submit" value="Insert Data"/>

in doinsert.php

$getlabel=$_POST['val'];
echo $getlabel;

nothing is printing, any help please ?

Upvotes: 0

Views: 2860

Answers (3)

fso
fso

Reputation: 154

Try with

<input type="hidden"   name="val" value="Stupid"  />

If you see something appearing, then you will find the problem

Upvotes: 2

Matanya
Matanya

Reputation: 6346

you are setting the value of the input with a name of val to an empty string, because you echo $_POST['lab']; as its value when the $_POST hasn't been created yet - ex nihilo nihil

try viewing the source in the browser and you'll see that the value is empty

Upvotes: 0

Naftali
Naftali

Reputation: 146310

echo will seem not to print anything if the value is null or "" (or any empty string thereof).

Try doing:

var_dump( $getlabel );

Upvotes: 0

Related Questions