Get ID from HTML form - PHP

Achilles

I've a html form for get Id from visitor

<form action="show.php" method="post">
 <p>Your id: <input type="text" name="id" /></p>
 <p><input type="submit" /></p>
</form>

and the php file for act this .

<?php
$id = ((int)$_GET["id"]);
$con=mysql_connect('localhost','user','pass');
mysql_select_db('dbname',$con);
$query="SELECT * FROM `users` WHERE id = '$id'";
$select=mysql_query($query);
while($row=mysql_fetch_array($select)){
echo $row['name'];
}
mysql_close($con);

?>

but it's not working , can't read id , pelase help me for resolve this issue

Thank you

Dharmang

As you have used form method "post", id variable will be available in the global $_POST array so use:

<?php
$id = ((int)$_POST["id"]);
....

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to get html Id from Php Code?

From Dev

Why does PHP not GET the form input from this HTML form?

From Dev

Get id from form

From Dev

Get a return from JQuery to a PHP variable in a simple HTML PHP Form

From Dev

How to get id from form in .html template in django python

From Dev

get data-id html from html table using php

From Dev

How to get file root value from html form or php

From Dev

not able to get the data from html form to php script

From Dev

How to get html form without form id

From Dev

Get Contact Form 7 Form ID In PHP

From Dev

Get var from form id

From Dev

Get values from HTML form

From Dev

cant get id value in to the html form

From Dev

Get all checkbox id on form submit php

From Dev

Get text from id in html

From Dev

How can I get post id from my html form to views.py

From Dev

How to get all the id elements values in a array from html form using jquery

From Dev

GET id from php with javascript

From Dev

Get id from a post php

From Dev

Django: Get the form name or id from template

From Dev

Get ID from submitted form in Django

From Dev

Validating HTML form and using the $_GET in PHP method

From Dev

how to get meta tags with php, but with html form

From Dev

HTML form handling with PHP GET method

From Dev

Way to get data from HTML form to Microsoft Flow without a page refresh and no php

From Dev

can I get text from html and put it into variable in php without submitting a form?

From Dev

php get id form url and show id on webapage

From Javascript

How to sent a value from javascript to a form and get the value as form id

From Dev

Get $_FILES from curl without HTML form

Related Related

HotTag

Archive