PHP question

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Alienz
New php-forum User
New php-forum User
Posts: 13
Joined: Wed Jan 29, 2003 8:24 am

PHP question

Postby Alienz » Sun Feb 09, 2003 1:19 am

What is the code for PHP to open a link?

User avatar
pootergeist
New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK
Contact:

Postby pootergeist » Sun Feb 09, 2003 2:28 am

a link (socket) to another server?

if not, what other sort of link would php (a solely serverside language) open?

... read above as 'please explain more'.

Alienz
New php-forum User
New php-forum User
Posts: 13
Joined: Wed Jan 29, 2003 8:24 am

Postby Alienz » Sun Feb 09, 2003 2:36 am

For example, I thinking of making a form using radio type. To let user to choose which option they want then it will go to the .php file to check whether which option they had choosen then redirect them to certain link.

example of the code
<form action="try.php" method="post">
<input type="radio" name="x value="one" checked>One
<input type="radio" name="x" value="two">Two
<input type="submit">
</form>

User avatar
Joan Garnet
Moderator
Moderator
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars
Contact:

Postby Joan Garnet » Sun Feb 09, 2003 11:38 am

In try.php I would choose the page where now should be redirected using a conditional:

Code: Select all

switch ($HTTP_POST_VARS["x"]){
   case "one":
      header("Location: info.php");
   break;
   case "two":
      header("Location: index.php");
   break;
   case "three":
      header("Location: whatever.php");
   break;
}

Alienz
New php-forum User
New php-forum User
Posts: 13
Joined: Wed Jan 29, 2003 8:24 am

Postby Alienz » Mon Feb 10, 2003 1:50 am

Thanks very much. I got it.


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 3 guests

cron