I got this form. They added a radio button selection. Now I would like the url behind the submit button to change depending on which radio button is selected. So every choice gets his own url and so it's own page. (this is needed for analytics) I am not very well know with php but it seems there is a way but can't get it to work.
<form id="contact-form" action="<?php echo SITE_URL; ?>/trial-email.php" class="contact-form" method="post">
<input type="hidden" name="locale" value="<?php echo $locale->language; ?>">
<input type="hidden" name="button" value="<?php echo $_GET['button']; ?>">
<input id="text1" type="text" name="company" placeholder="Company name" />
<input id="text2" type="text" name="name" placeholder="Name>" />
<input id="email1" type="email" name="email" placeholder="Email" />
<input id="tel1" type="tel" name="phone" placeholder="Phone" />
<div class="how-find-us">
<span class="how-title">How did you find us?</span>
<input class="how-radiobutton" type="radio" name="howbutton" value="Online advertisement" checked>Online advertisement
<input class="how-radiobutton" type="radio" name="howbutton" value="Google">Google
<input class="how-radiobutton" type="radio" name="howbutton" value="A Friend told me">A Friend told me
<input class="how-radiobutton" type="radio" name="howbutton" value="Other">Other
</div>
<input id="captcha" name="captcha" type="text" placeholder="<?php __translate('Fill in the characters'); ?>" />
<div class="captcha_image" >
<?php
$_SESSION['captcha'] = simple_php_captcha();
echo '<img src="' . $_SESSION['captcha']['image_src'] . '" alt="CAPTCHA" />';
?>
</div>
<span class="submit-holder"><input id="submit" class="btn" type="submit" value="<?php __translate('Get trial'); ?>"/></span>
</form>
I tried the code below but it did not work, it even broke the page.
<form action="" method="post">
<input class="how-radiobutton" type="radio" name="howbutton" value="Online advertisement" checked>Online advertisement
<input class="how-radiobutton" type="radio" name="howbutton" value="Google">Google
<input class="how-radiobutton" type="radio" name="howbutton" value="A Friend told me">A Friend told me
<input class="how-radiobutton" type="radio" name="howbutton" value="Other">Other
<span class="submit-holder"><input id="submit" class="btn" type="submit" value="get trial"/></span>
</form>
<?php
if (isset($_POST['submit'])) {
if(isset($_POST['radio']))
{
echo "You have selected :".$_POST['radio']; // Displaying Selected Value
}
?>
I read that it is possible to use the $_GET because that saves info in the url?!
</div>