1

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

asked Jul 15, 2010 at 10:11
1
  • Why do you need it to be sent as url parameter? you can use the GET method of HTTP to have all the form params in the URL Commented Jul 15, 2010 at 10:17

3 Answers 3

5
<form method="GET" action="abc.php" enctype="multipart/form-data"> 
 <input type="text" name="number" value=""/> 
 <input type="submit" name="search" value="SEND"/>
</form>
answered Jul 15, 2010 at 10:13
Sign up to request clarification or add additional context in comments.

3 Comments

hi,thx for your quick reply. sorry for late..because i test it many way...Can i do it using post method?because on the action parameter i have to include other some parameters.like: <form method="POST" action="abc.php?text=somethoing&address=something&number=something" enctype="multipart/form-data"> thats why i need to use post method.Can i do it using post method??
Sure, if you modify your script to get the value from $_POST.
I have 2 parameters.1 of them is collected from script and one i should take from text box input.let see my example: <form method="post" action="friend.php?title=<?php echo htmlspecialchars(@$msg_to_friend)?>&number=""?>" enctype="multipart/form-data"> i can collect both data one using $_POST and another using $_GET mothod. But my problem is i have to send both data on the action parameter.so i can i do it???can u help pls..
3

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.

answered Jul 15, 2010 at 10:15

Comments

1

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.

answered Jul 15, 2010 at 10:18

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.