473,325 Members | 2,442 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Display php forms on click of radiobuttons

Hi all. I have stuck up with a new problem.Hope anyone can find some solution for that.
I have three radiobuttons and the situation is that on click of each radio button a new php page is to be opened. I have done it using submit button. But actually it has to be done ON CLICK of the radiobuttons on not on SUBMIT.

The code i used for submit is given below. PLz help to customize this code so as to be helpful to satisfy the demanded situation

Thanks and Regards
TechnoAtif

[PHP]<form name="myForm" action="log_in.php" method="get">
<input type="radio" name="r" value="archilogin.php" selected="selected" onclick="this.form.action=this.value;"> Architects<br>
<input type="radio" name="r" value="conslogin.php" onclick="this.form.action=this.value;"> Consultants<br>
<input type="radio" name="r" value="varlogin.php" onclick="this.form.action=this.value;"> Others<br>
<input type="submit" value="Submit">
</form>[/PHP]
Feb 16 '08 #1
4 3094
In addition to the code mentioned in my first post i have also made use of headers as the alternatite solution.But it also works on click of SUBMIT buttton and not just clicking the radiobutton. THe code is given below.Anyone kindly rescue me.

Thanks and Regards
TechnoAtif

[PHP]

<?php

$host=$_SERVER['HTTP_HOST'];
$folder="archidesign";



if (isset($_POST['submit'])) {

$selected_radio = $_POST['login_page'];

if ($selected_radio == 'archi') {
header("Location:http://$host/$folder/archilogin.php");
}
else if ($selected_radio == 'consult') {
header("Location:http://$host/$folder/conslogin.php");
}

else if ($selected_radio == 'various') {
header("Location:http://$host/$folder/varlogin.php");
}

}

?>[/PHP]

[HTML]<form name="form1" method="post" action="log.php">
<table width="194">
<tr><td><h1 class="articles">Members Login</h1></td>
</tr>
<tr>
<td width="114">

<input type="radio" name="login_page" value="archi">
Architects</td></tr>

<tr><td width="114">
<input type="radio" name="login_page" value="consult">
consultants</td></tr>

<tr><td width="114">
<input type="radio" name="login_page" value="various">
Others</td><td width="68"><input name="submit" type="submit" value=go></td>
</tr></table>
</form>[/HTML]
Feb 16 '08 #2
ronverdonk
4,258 Expert 4TB
Use location.href to go to a new page, as follows:
[html]
<input type="radio" name="r" value="archilogin.php" selected="selected" onclick="location.href=this.value;"> Architects<br>
<input type="radio" name="r" value="conslogin.php" onclick="location.href=this.value;"> Consultants<br>
<input type="radio" name="r" value="varlogin.php" onclick="location.href=this.value;"> Others<br> [/html]
Ronald
Feb 16 '08 #3
Hey !!! Thanx Roverdonk.

You made my day. it was so simple.I will be back here on this forum to have some xtra tips if some othre problem exist s.Until then...bye.and great job [:)]

Thanx and Regards
TechnoAtif
Feb 18 '08 #4
ronverdonk
4,258 Expert 4TB
You are welcome. See you next time.

Ronald
Feb 18 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: LeeB | last post by:
I have XP-Pro and VS.NET 2002. I developed some software (.aspx and .aspx.vb) on my machine. I got it to work. A game that displays an HTML table (with colors and images in the cells) and several...
10
by: DettCom | last post by:
Hello, I would like to be able to display or hide fields based on whether a specific Yes/No radio button is selected. This is in conjunction with a posting a just made here in the same group...
4
by: Marc | last post by:
Is there a way to produce 3 radio buttons, which when one is selected, enables 11 check boxes which are otherwise disabled (greyed out)? EXAMPLE: Option 1 --Radio buttons Option 2 Option 3 ...
7
by: Stefan Finzel | last post by:
Hi, is there a way to change the display property on Windows Mobile 2003 SE Mobile/Pocket Internet Explorer? See following example. Please note: visibilty property has the same problem. Is...
0
by: Luis Esteban Valencia Muñoz | last post by:
I have a DataList, which looks a bit like this: <asp:DataList id="dlstCheeseType" runat="server" RepeatColumns="4" RepeatDirection="Horizontal" ShowHeader="False" ShowFooter="False"...
4
by: news.microsoft.com | last post by:
Hello, I have two databound radiobuttons which have advanced databinding properties of onpropertychanged enabled so that I can raise the columnchanged event whenever the radiobuttons are...
34
by: Luke | last post by:
Hi! I am new to PHP but I am a very experienced in Perl/CGI/templates. I work in medical informatics when we deal with very large data collection forms. Some of them have over 1000 elements!...
0
by: PaulS | last post by:
Hello! I put on Form PictureBox and I set big image. Next I put many radiobuttons (80) on PictureBox, but I have problem. I want that 10 radiobuttons have own Checked, next part of 10...
9
by: tshad | last post by:
I have a Windows App that is doing some work and then writing a "Now Processing..." line to the status line of the window as well as the Textbox on the form. But the problem is that the work is...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.