Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submit form

Status
Not open for further replies.
Mar 20, 2003
103
AU
Im new to php.

This is a modified extract of one of my page.


<form action=" method=post name=frmQuickSearch onsubmit=Javascript:return(validateForm())>
<input type="text" name="whcode" value="">

How does the script look like for placing the value in the text box whcode on the URL on the Form tag for parsing purposes? I know in ASP it is


but how does PHP looks like?
 
Hope I understand you here, but of you do method=get on the <form> it will happen by default.
 
Yikes...thats not what I meant.
But thanks for trying.

Anyway, I'll try to reword again

assume that there is a text input box and a submit button on the page.

I would like to submit/parse the value of the input box via the URL.

eg...

if I keyed in 007
Upon submit the url will
look like
that however if it is in ASP format. BUT

I would like to do it in PHP

So what do I put in the ????
I know ASP I have to place <%=request.form("text input name")%>
But what is the PHP version?
 
Depending on how it was submitted:
$_POST["input_name"]
or
$_GET["input_name"]

Or for older versions
$HTTP_POST_VARS["input_name"]
or
$HTTP_GET_VARS["input_name"]
 
hmm, you could do this in php but you would be much faster doing it in javascript or vbscript.... to complete this task, to the best of my knowledge, you would need to:
1. generate the form.
2. submit the form
3. redirect the page with the correct url.....
Code:
<?php
$var = $_GET["form_value"];
if ($var == ""}
  {    display empty form..... }

if ($var <> "")
   {  $location = "[URL unfurl="true"]http://www.test.c/index.php?id=".$var;[/URL]
      header($location); exit;
   }
?>
is long winded but may be what you need.
 
You know I just don't understand this !!.
I totaly understnad what Moonspell is saying but that is at the PHP end, the original post seems to imply manipilating the original browser request.
 
The original post seems to be asking for some client side manipulation. I know little about ASP, but from the PHP end it looks like this:
1. PHP is server-side. Once the page is sent it's off to the client and any manipulation within the cleint browser depends on a client side technology, e.g. JavaScript
2. The only way to do this is exactly what Moonspell has presented.

Here's the question that remains:
Why would you need such a long winded way to do things? You are practically asking for something like
<form method="post AND get"....>
I'm just curious why you want that. Maybe there is an easier, readily available solution to achieve the same thing you are trying to get through this.
 
That's it, like in my intial response to this question it happens any why mess about it.
If he wants to alter the value from the text box, that's a differecnt question.
Borgling,
can you knock a bit of ASP and post it here so I/we can see what you are trying to do at the server end.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top