?
Solved

php goto

Posted on 2011-10-18
4
Medium Priority
?
288 Views
Last Modified: 2012-05-12
I need some code to help me

I have a textbox(value of 250)

I want whatever is in textbox to go at the end of a url
eg

http://localhost/test.php?clientID=textbox(250)
0
Comment
Question by:beridius
  • 2
4 Comments
 
LVL 10

Expert Comment

by:Derokorian
ID: 36986516
<form action="test.php" method="get">
   <input type="text" name="clientID">
   <input type="submit" value="Submit">
</form>

Open in new window



Is this what you are looking for? when you press submit you will get the outcome you are looking for...
0
 
LVL 2

Author Comment

by:beridius
ID: 36986563
not realy

<label for="textfield">Client ID</label>
      <input type="text" name="searchclient" id="searchclient" method="post" action="search-client.php" />
      <input type="submit" name="button" id="button" value="Search" />
    </form>

Open in new window


then on search-client.php

<?php

$clientsearch = $_POST['clientsearch'];
$_SESSION['clientsearch']=$clientsearch;


if ($clientsearch!=""){
	
	header('location: http://localhost/Client-detail.php?clientID=',$clientsearch);
}



?>

Open in new window

0
 
LVL 27

Expert Comment

by:Lukasz Chmielewski
ID: 36988083
if ($clientsearch!=""){
      
      header('location: http://localhost/Client-detail.php?clientID='.$clientsearch);
}
0
 
LVL 27

Accepted Solution

by:
Lukasz Chmielewski earned 2000 total points
ID: 36988112
Well, not really again, try this:

<label for="textfield">Client ID</label>
      <input type="text" name="searchclient" id="searchclient" method="post" action="search-client.php" />
      <input type="submit" name="button" id="button" value="Search" />
    </form>

Open in new window


<?php

$clientsearch = $_POST['searchclient'];
$_SESSION['clientsearch']=$clientsearch;


if ($clientsearch!=""){
	
	header('location: http://localhost/Client-detail.php?clientID='.$clientsearch);
}
?>

Open in new window


The $_POST array needs to have the names from the "name" attribute from the form
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month16 days, 8 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question