LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   PHP question (https://www.linuxquestions.org/questions/programming-9/php-question-794457/)

mussarath 03-09-2010 10:30 PM

PHP question
 
can you please send some sample code for HOW TO SEND ARGUMENTS IN PHP PROGRAMMING?
am very new to the php.

Xyro 03-10-2010 03:12 PM

$_POST and $_GET will give you somewhere to start.

$_POST

sender.php:

PHP Code:

<form method="post" action="receiver.php">
  <
input type="text" name="field1">
  <
input type="text" name="field2">
  <
input type="submit" value="Send">
</
form

receiver.php:
PHP Code:

<?php
  $field1_string 
$_POST['field1'];
  
$field2_string $_POST['field2'];
  echo 
"Field one: " $field1_string;
  echo 
"Field two: " $field2_string;
?>

$_GET

sender.php:

PHP Code:

<a href="receiver.php?var1=foo&var2=bar">Send</a

receiver.php:
PHP Code:

<?php
  $var1_string 
$_GET['var1'];
  
$var2_string $_GET['var2'];
  echo 
"Variable one: " $var1_string;
  echo 
"Variable two: " $var2_string;
?>

Try these--I haven't so it is possible that I've included a mistake.


All times are GMT -5. The time now is 03:13 AM.