PHP Form Handling in Hindi - Form Handling In PHP In Hindi

  PHP Form Handling in Hindi - Form Handling In PHP In Hindi इस Article में हम PHP Form Validation के बारे में पूरी तरह से जानेगे।  ये काफी Important और सबसे आसान काम होता है।  जो PHP developer को बहुत ही अधिक करना होता है।  यानि ये Work हर एक Website में होता है।  तो PHP Form validation in Hindi को पूरी तरह से जाने। 

PHP Form Handling in Hindi - Form Handling In PHP In Hindi


PHP Form Handling in Hindi

Form handling का मतलब है।  जो Form HTML में हम बनाते है।  उसके PHP के द्वारा Handle करना।  Form का Data PHP के द्वारा Backend में Store करना या इसकी मदद से Show करना।  इसके अंतर्गत सभी Forms आ जाते है।  जैसे - Contact Form , Login Form , Registration Form या अन्य। 

Form handling के लिए PHP हमें Superglobals Variable Provide करता है।  जिसमे $GET और $POST Variable है।  जिनका Use किया जाता है।  इस Article में हम इन्ही Variable का Use करके Form handling करेंगे। 

सबसे पहले हम एक HTML का Form Create करते है। 

<!DOCTYPE html>
<html>
<body>

<h2>HTML Forms</h2>

<form action="" method="POST">
<lebel for="fname"> First Name:</lebel><br>
<input type="text" name="email" id="email"><br>
<lebel for="fname"> Emain Id:</lebel><br>
<input type="text" name="name" id="email"><br>
<lebel for="fname"> Mobile No:</lebel><br>
<input type="text" name="mobile" id="mobile"><br>
<input type="submit" value="Submit">
</form>


</body>
</html>

Output
ये आप देख सकते है।  हमने एक HTML Form बनाया है।  


VariableExplanation
$POST    POST method का Use करके हम सभी Form का data Backend में Store करा सकते है।  
$GET GET Method का भी Use करके Form का data Store करा सकते है।  लेकिन इसका Data URL के द्वारा जाता है।  इसीलिए वो data Url में Show होता है। 
$Request Request Variable के द्वारा GET और POST Method का Use किये HTML Form Data को Access कर सकते है।  
<!DOCTYPE html>
<html>
<body>

<h2>HTML Forms</h2>

<form action="" method="POST">
<lebel for="fname"> First Name:</lebel><br>
<input type="text" name="email" id="email"><br>
<lebel for="fname"> Emain Id:</lebel><br>
<input type="text" name="name" id="email"><br>
<lebel for="fname"> Mobile No:</lebel><br>
<input type="text" name="mobile" id="mobile"><br>
<input type="submit" value="Submit">
</form>
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
$name = $_REQUEST['name'];
$mob = $_REQUEST['mobile'];
$email = $_REQUEST['email'];


echo "Your Name Is : $name <br>";
echo "Your Mobile Number is : $mob <br>";
echo "Your Email Id Is : $email <br>";
}

?>

</body>
</html>

Output 


इसमें जैसे ही हम Data को Form में fill करते है।  और Submit पे click करते है।  तो वो Data हमें नीचे Show होता है। 

Comments

Popular posts from this blog

Finding A College Scholarship For A Single Mother

Sports Cars for Girls

Porsche vs Ferrari