واپس چلیں   پاکستان کی آواز > IT کی دنیا > پروگرامنگ > php پروگرامنگ



php پروگرامنگ php پروگرامنگ


Introducing FORMS In PHP

short url
موضوع بند کر دیا گیا ہے
 
LinkBack موضوع کے اختیارات موضوع کی درجہ بندی ظاہری انداز
پرانا 01-08-07, 10:45 AM   #1
Member
اجنبی
 
مبشر's Avatar
 
تاریخ شمولیت: Jul 2007
عمر: 27
مراسلات: 75
کمائي: 415
شکریہ: 2
12 مراسلہ میں 28 بارشکریہ ادا کیا گیا
Default Introducing FORMS In PHP

Introducing FORMS In PHP

Okay till now we were working on single PHP pages and there was little interaction, take the example of the multiplication table, wouldn�t it be great if the user could enter which multiplication table he wanted and then we could give him that result.

As PHP is a server side scripting language user interaction can only occur when we send some info to the server, in turn the server processes our request and sends the requested page, thus we need to post (Send) data to the server.

To illustrate I will show you an example: Let's build a multiplication table code where in the first page (ask_user.htm) we ask the user which table he wants and in the second page (table_results.php) we get that info and sends him the table.
ask_user.htm

کوڈ:
<html>
<body>
<form method=post action=table_results.php>

Enter the multiplication table number <input type=text name=table size=2>

<input type=submit>
</form>
</body></html>
What we have done in the above html page is that we have created a HTML FORM that is going to POST (send) data to the PHP file table_results.php, this file will be called by the web-server and processed after processing it will be sent to the browser.

The PHP global array $_POST['variable name'] which is a built in super global array in PHP contains all the data that is posted by a form, you just need to pass your variable name to retrieve the data that you have posted.

table_results.php

کوڈ:
<html><body>
<?php
$cnt = 1;
$table = $_POST['table'];

while($cnt != 11)
{
echo "$table x $cnt = ". $table * $cnt;
$cnt++;
}
?>
</body></html>
Analyzing the code: Enter any number in the above HTML form and press enter voila! you get the multiplication table for that, but how does the other program table_results.php know which table to process.

Remember we have posted data to the server, see this line <input type=text name=table size=2> holds the value of the table. We have named the input field as table which now become our variable that stores the info.

We retrieve the value of the table using $_POST['variable_name'] , in our case our variable that hold the value is table so we wrote the code $table=$_POST['table']; which retrieves the value and stores it in the $table variable.
مبشر آف لائن ہے  
پرانا 01-08-07, 10:59 AM   #2
Administrator
 
منتظمین's Avatar
 
تاریخ شمولیت: May 2007
عمر: 36
مراسلات: 11,361
کمائي: 171,667
شکریہ: 9,810
7,526 مراسلہ میں 22,598 بارشکریہ ادا کیا گیا
Default جواب: Introducing FORMS In PHP

بہت عمدہ سبق ہے ۔ آج اس کو دہراوں گا۔

میں کچھ سوال پوچھنا چاہ رہا ہوں۔

1- سپر ارائے کیا ہوتا ہے ؟ اور اسکا کیا مقصد ہو تا ہے؟


2- اس روٹین کا کیا مطلب ہے
کوڈ:
while($cnt != 11)
{
echo "$table x $cnt = ". $table * $cnt;
$cnt++;
}
3- اپ نے echo میں ““ اور . کا استعمال کیا ہے ان کا کیا فنکشن ہوتا ہے۔

والسلام
__________________
تم سپاہی نہیں ہو پیشہ ور قاتلو!
منتظمین آف لائن ہے  
پرانا 28-12-07, 06:32 PM   #3
Senior Member
 
عرفان حیدر's Avatar
 
تاریخ شمولیت: Dec 2007
مقام: کراچی
عمر: 30
مراسلات: 2,046
کمائي: 8,260
شکریہ: 889
722 مراسلہ میں 1,442 بارشکریہ ادا کیا گیا
عرفان حیدر کو MSN کے ذریعے پیغام ارسال کریں عرفان حیدر کو Yahoo کے ذریعے پیغام ارسال کریں
Default جواب: Introducing FORMS In PHP

سلام،
مذکورہ دھاگے کو بند کیا جارہا ہے کیوں کہ اس میں گذشتہ ایک مہینے سے کو ئی نیا مراسلہ نہیں ڈالا گیا۔
تما م مراسلے ارسال کرنے والے خواتین و حضرات کا شکریہ۔
وسلام،
عرفان حیدر آف لائن ہے  
موضوع بند کر دیا گیا ہے

Tags
color, data, forms, global, great, php, آج, جواب, حضرات, خواتین


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
موضوع کے اختیارات
ظاہری انداز Rate This Thread
Rate This Thread:


Similar Threads
موضوع موضوع شروع کیا فورم جوابات آخری مراسلہ
Introducing PHP مبشر php پروگرامنگ 7 28-12-07 06:28 PM


تمام اوقات پاکستانی معیاری وقت ( +5 GMT) کے لحاظ سے ہیں۔ ابھی وقت ہے 08:27 PM

Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO
جملہ حقوق نشرو اشاعت ©2000 - 2012,پاکستان کی آواز - پاکستان کے فورمزکی انتظامیہ کے پاس مخفوظ ہیں۔ ہم اردو ترجمے کے لیے جناب زبیرکے مشکور ہیں-
اپنا بلاگ مفت حاصل کریں wordpress.pk
ہم pak.net ڈومین نیم کے لیے جناب فاروق سرور خان کے مشکور ہیں

Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
Ad Management plugin by RedTyger