PDA

View Full Version : Form HELP! +rep



Isolde
17-02-2007, 04:47 PM
Hi, do you know how i can make a Radio Button, where you check the box, click submit, and take you to a page of the product you selected?

+rep to whom would give the script to me.

Edited by Lµke (Forum Moderator): Thread Moved From Website Designing. Please post in the correct section next time, Thanks :).

kooldude007
17-02-2007, 04:55 PM
anywho i dont get this, what do you want, i cannot understand im three qaurters brazillian,

Drompo
17-02-2007, 05:05 PM
Radio Buttons Form example



<FORM METHOD=post ACTION="/cgi-bin/example.cgi">
Select an option:<BR>
<INPUT type="radio" name="option"> Option 1
<INPUT type="radio" name="option"> Option 2
<INPUT type="radio" name="option"> Option 3
<INPUT type="Submit" VALUE="Submit">
</FORM>


Unsure what you mean after that.

P.S i helped with your forum query too.

Isolde
17-02-2007, 05:19 PM
Yeah and when u select one of those options, it leads to 'cgi-bin/example.cgi' right? I want the script for 'cgi-bin/example.cgi' so that the option u selected pears on that page after submitting?

kooldude007
17-02-2007, 05:23 PM
Now you have lost me

Isolde
17-02-2007, 05:24 PM
Right. I wanna make a form, where you select an option. When you check the box and click submit, it takes you to a webpage instead of a thanks page, it's a page of what you've selected. Now u get it?

Drompo
17-02-2007, 05:48 PM
Make this selected.php



<html>
<head>
<style type="text/css">
<!--
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: small;
}
-->
</style>
</head>
<body>

<form action="selected.php" method="post" class="style1">

<!-- DO NOT change ANY of the php sections -->
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>

<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
Options Avaliable: <br />
<INPUT type="radio" name="option" value="Number 1"> Number 1<BR>
<INPUT type="radio" name="option" value="Number 2"> Number 2<BR>
<INPUT type="radio" name="option" value="Number 3"> Number 3<BR>
<br />
<input type="submit" value="Select" />
</form>
</body>
</html>
Call this selected.php


<?php
echo "You Selected: $option"
?>


Tested And Works!

kooldude007
17-02-2007, 05:49 PM
oh ok but the code above works, i think.

Isolde
17-02-2007, 05:53 PM
Exactly what i wantted but it doesn't show.. it says 'You Selected:' and thats it.

http://www.host.direct-hosts.net/badges/select.php

Drompo
17-02-2007, 05:56 PM
http://www.clubbinghabbos.net/ash/options.php - Works for me (http://www.clubbinghabbos.net/ash/options.php)

Edit: it has to be called Selected not select.

You can change this in the options.php file

Isolde
17-02-2007, 06:02 PM
Yeah but not both of them cant be called selected.php

ZAG
17-02-2007, 06:02 PM
If it doesnt work, try changing the selected.php file to



<?php
$option = $_POST['option'];
echo "You Selected: ".$option;
?>

Drompo
17-02-2007, 06:04 PM
options.php

<html>
<head>
<style type="text/css">
<!--
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: small;
}
-->
</style>
</head>
<body>

<form action="selected.php" method="post" class="style1">

<!-- DO NOT change ANY of the php sections -->
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>

<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
Options Avaliable: <br />
<INPUT type="radio" name="option" value="Number 1"> Number 1<BR>
<INPUT type="radio" name="option" value="Number 2"> Number 2<BR>
<INPUT type="radio" name="option" value="Number 3"> Number 3<BR>
<br />
<input type="submit" value="Select" />
</form>
</body>
</html>
selected.php



<?php
echo "You Selected: $option"
?>


This code has changed from the one i posted 10 mins ago. Sorry for any inconvience.

Isolde
17-02-2007, 06:06 PM
Thanks th0m4s. +rep it works now.
And thanks Drompo. +rep for script.

Isolde
17-02-2007, 07:08 PM
@ thomas

Yeah but don't i need to change anything 'selected.php' to make all the chekboxs that a person has selected appear? I tried to cheak all boxs and only 1 appears.

see http://www.host.direct-hosts.net/tests/options.php

Want to hide these adverts? Register an account for free!