Hack Forums
[PHP] Capture user inputs on a website - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Web Development (https://hackforums.net/forumdisplay.php?fid=183)
+---- Thread: [PHP] Capture user inputs on a website (/showthread.php?tid=5713963)



Capture user inputs on a website - dark_angel1 - Sep 9, 2017

Please I need a Php file to Capture user inputs on a website

Thanks


* - Charger - Sep 9, 2017

Google php post
Php file put contents


* - dark_angel1 - Sep 9, 2017

(Sep 9, 2017 04:02 AM)Charger Wrote:  Google php post
Php file put contents

Please I can't get it, could you explain a little bit?


* - randomUsername25214 - Sep 9, 2017

(Sep 9, 2017 04:06 AM)dark_angel1 Wrote:  Please I can't get it, could you explain a little bit?

I am bad at explaining but:

You can send a post request via html using this code(page.php is the page you want to send the request to.):

PHP Code

<?php 
//Evrything in the <form> code will be sent
<form method="post" action="page.php">
//Textbox to put value in
<input type="text" name="value1" />
//Button to send post request
<input type="submit" value="Send" />
</
form> 

In page.php you will have this code:
PHP Code

<?php
$value1 
= $_POST['value1'];//This will get the value of the textbox and put it in $value1

echo $value1;//This will echo out the value
?>



* - dark_angel1 - Sep 9, 2017

(Sep 9, 2017 04:24 AM)KA34 Wrote:  I am bad at explaining but:

You can send a post request via html using this code(page.php is the page you want to send the request to.):

PHP Code

<?php 
//Evrything in the <form> code will be sent
<form method="post" action="page.php">
//Textbox to put value in
<input type="text" name="value1" />
//Button to send post request
<input type="submit" value="Send" />
</
form> 

In page.php you will have this code:
PHP Code

<?php
$value1 
= $_POST['value1'];//This will get the value of the textbox and put it in $value1

echo $value1;//This will echo out the value
?>

thanks Mate


(Sep 9, 2017 04:32 AM)Yani Wrote:  People like you make me fucking mad.

Google it

I couldnt find it from google thats why I post it here, and nobody force you to reply me.


* - Tommy Chong- - Sep 11, 2017

(Sep 9, 2017 04:37 AM)dark_angel1 Wrote:  thanks Mate



I couldnt find it from google thats why I post it here, and nobody force you to reply me.

Then you should consider learning how to properly do google searches


* - BenzaHdd - Sep 12, 2017

You need to use a POST or a GET. POST's are recommended as GET's can easily be forged and adapted.

Do something like this :

HTML

<form method="POST">

<input type="text" placeholder="Your name here" name="name" />
<input type="number" placeholder="Your age here" name="age" />
<input type="submit" value="Submit" />

</form>

PHP

<?php

$error = 'Your name and age is required';

if(isset($_POST)) {

if(isset($_POST['name']) && isset($_POST['age'])) {
$name = $_POST['name'];
$age = $_POST['age'];
echo $name.', your age is '.$age;
} else {
echo $error;
}

} else {
echo $error;
}

?>

Hope it helps.


* - Nixco - Sep 12, 2017

index.html
Code
<form method="POST" action="login.php">
          <input type="text" name="username" />
          <input type="password" name="password" />
</form>

login.php
Code
<?php
$username = $_POST['username'];
$password = $_POST['password'];
echo 'Your password is ' . $password . ', Mr. ' . $username;
?>

Just to explain the concept. Please do research about MySQL injections if you intend onto storing data into a local database. The code I provided is not intended for public use.


* - grady - Sep 12, 2017

https://www.w3schools.com/php/php_forms.asp

If you tried using Google, you should give up on learning to code.
There's a point where you need to ask a forum, and this is not one of those.
If you can never figure out this by yourself, you will literally never make any progress.

DO NOT DEPEND ON OTHERS FOR YOUR OWN PROGRESS.


* - #Skyline - Sep 13, 2017

(Sep 12, 2017 04:34 PM)๖ۣۜInfamy Wrote:  If you tried using Google, you should give up on learning to code.

I reckon he should give up on a lot more then just code if he can't google correctly.