How to get textbox value in php without clicking submit


#1

Tiis is my Input box <input type=“text”

I want to pass what i typed value to php variable like <a href=“abc.php?id=<?php echo $textbox ;?>”" >

what should i do please help me

thanks & regards,
Darshan N


#2

AJAX call using and event


#4

that one also tried if what result i got through ajax it is not getting outside that calling id


#5

I need more information or more code to understand.


#6

<input type=“text” name=“amount” ///////////////////////// textbox enter amount

<a href=“abc.php?id=textbox value” //////////////////////// i want to fetch what amount what i entered in the above textbox , is this possible…?


#7

If you mean you are passing the value to another page such as abc.php?id=… Then, you just use GET…

In the abc.php code, you “get” the value of id…

$id = $_GET[‘id’];

You should check to make sure it is not blank after you get it.


#8

your’s is right but i want that id value what i typing in the text box

eX: <input type=“text” --------------------->I am typing value as 250

I want in link value

<a href=“abc.php?id= 250

thanks,


#9

Yes, if it is an integer, you do not use quotes.
OR, you can force it to int like this: $id = settype($_GET[‘id’], “integer”);
But, it is simpler to just set it correctly from the start…


#10

It’s pretty basic.

<form method="post">
 <input name="id">
 <input type="submit" value="Submit">
</form>

<?php if ($_POST): ?>
<a href="abc.php?id=<?= $_POST['id'] ?>"><?= $_POST['id'] ?></a>
<?php endif; ?>

#11

thank you