tags:

views:

41

answers:

3

hi all,

Can i send a input value into form action ?Let say, on the form the phone number taken.Now can i send the phone number as form action parameter "number"? Is their any way to send it?

<form method="post" action="abc.php?number=ph_number" enctype="multipart/form-data">   
   <input type="text" name="ph_number" value=""/>                   
   <input type="submit"  name="search"  value="SEND"/>
</form>

How can i do it?

Thanks in advance
riad

+2  A: 
<form method="GET" action="abc.php" enctype="multipart/form-data">   
   <input type="text" name="number" value=""/>                   
   <input type="submit"  name="search"  value="SEND"/>
</form>
Ignacio Vazquez-Abrams
riad
Sure, if you modify your script to get the value from `$_POST`.
Ignacio Vazquez-Abrams
riad
+1  A: 

Change action="abc.php?number=ph_number" to action="abc.php

Change name="ph_number" to name="number"

When you click submit, the value contained in "number" text field will be passed to abc.php.

Receive the value with $value = $_REQUEST['number']; in abc.php.

kobrien
+1  A: 

You can leave an empty action, and use the onSubmit event to load a javascript function that does whatever and redirects to the page according to the input value.

Html

<form .. action="" onsubmit="return abcByPhone(this);">

Javascript

function abcByPhone(form) {
   url = from.number.value;
   ...
}

EDIT: I actually didn't read the question properly. I thought you wanted to redirect to different pages according to the input. Using plain GET (like the others mentioned) is fine for this.

Itsik