Thephpdoge Thephpdoge - 1 month ago 14
PHP Question

How do I post disabled input

Hello I have some input but one of them is disabled ( yes and i need it for my time sheet )but how do I send it autocomplete.php to insert.php I've this error Undefined index: client1 in C:\wamp\www\testlp\insert.php on line 30

Here my code autocomplete.php

<form action = 'insert.php' method="post" >

<input type="text" name="client1" class = "client" size="12" id ="client1" disabled />

</form>


here my code insert.php

session_start();
$date = $_POST['data'] ;
$client1 = $_POST['client1'] ;

echo($client1);
echo($date);


EDIT I tried this :

<input type="text" name="client1" class = "client" size="12" id ="client1"readonly />


here the error :
Notice: Undefined index: client1 in C:\wamp\www\testlp\insert.php on line 12

Answer

There is no value for client1. Please add something like

value="TEST"

to your input.

echo $_POST['client1']; // TEST

Edit: remove session_start(); Why are you using this?

Comments