0

my code is as follows

<form method="post" action="raf_details.php?raf=<? echo $_POST['raf']; ?>">
<table width="60%" border="0" cellspacing="2" cellpadding="2" align="center">
  <tr style="background-color:#C1C1C1" align="center">
    <td>RAF</td>
    <td>Phone Number</td>
    <td>Search</td>
  </tr>
  <tr align="center" bgcolor="#E8F8FF" style="background-color:#E1E1E1">
    <td><input type="text" name="raf" id="raf" value="<?php echo $_POST['raf'];?>" /></td>
    <td><input type="text" name="phone" id="phone" value="<?=$_POST['phone'];?>"/></td>
    <td><input type="image" src="../images/btnFind.png" id="find" name="find"  /></td>
  </tr>
</table>
</form>

But it is not fecthing $_POST['raf'] value in url my url is just showing

http://localhost:8888/ample/payment/raf_details.php?raf=
3
  • 1
    YOu can directly use $_POST['raf'] in raf_details.php without passing in action URL. Commented Sep 11, 2013 at 5:55
  • Do you get anything in <input type="text" name="raf" id="raf" value="<?php echo $_POST['raf'];?>" Commented Sep 11, 2013 at 5:57
  • check that $_POST['raf'] has value or not? Commented Sep 11, 2013 at 6:14

3 Answers 3

2

You need to use get method for your form like

<form method="get" action="raf_details.php">

Then on submitting your form the url will be like

/raf_details.php?raf=somthing
Sign up to request clarification or add additional context in comments.

Comments

0

Yes that's true. However you can access it from $_GET['raf']. You can send get and post params simultaneously.
But a good practice solution would be this:

<!-- remove the raf from the action -->
<form method="post" action="raf_details.php">
<!-- ****************add this line ****************** -->
    <input type="hidden" name="raf" value="<? echo $_POST['raf']; ?>" />
<table width="60%" border="0" cellspacing="2" cellpadding="2" align="center">
  <tr style="background-color:#C1C1C1" align="center">
    <td>RAF</td>
    <td>Phone Number</td>
    <td>Search</td>
  </tr>
  <tr align="center" bgcolor="#E8F8FF" style="background-color:#E1E1E1">
    <td><input type="text" name="raf" id="raf" value="<?php echo $_POST['raf'];?>" /></td>
    <td><input type="text" name="phone" id="phone" value="<?=$_POST['phone'];?>"/></td>
    <td><input type="image" src="../images/btnFind.png" id="find" name="find"  /></td>
  </tr>
</table>
</form>

Comments

0

we can send paramaters using GET and POST. if you want pass variables in url use the GET method.

<form method="get" action="raf_details.php">

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.