Need help passing values to post form


Need help passing values to post form



I'm trying to change the values in a form based on which radio button is selected. It's passing the key to the php but not the value to my php. I'm trying to send it via POST and picking up the variables on the other side



I'm working off the example found here : https://bootsnipp.com/snippets/featured/sexy-radio-butons


<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
http://netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js
http://code.jquery.com/jquery-1.11.1.min.js
<style>
input[type=submit] {
width: 5em; height: 2em;
font-size: 20px;
font-weight: bold;
}
#radioBtn .notActive{
color: #3276b1;
background-color: #fff;
}
</style>
</head>
<body>
<br><br>
<h2>Notification settings for: ****@vtext.com</h2>
<br>
<br>
<form action="http://****.com/temp_update_notifications.php?v=1530296464" method="post">
<input type="hidden" id="hash" name="hash" value="YgSeBiAcEg">
<input type="hidden" id="email" name="email" value="****@vtext.com">
<input class="btn btn-primary btn-lg" type="submit" value="Update">
<br>







Current setting: Active


<input type="hidden" name="3885 Walkin Door" id="3885 Walkin Door">

</div>
</div>
</div>
</div>
</div>
</form>

$('#radioBtn a').on('click', function(){
var sel = $(this).data('title');
var tog = $(this).data('toggle');
$('#'+tog).prop('value', sel);

$('a[data-toggle="'+tog+'"]').not('[data-title="'+sel+'"]').removeClass('active').addClass('notActive');
$('a[data-toggle="'+tog+'"][data-title="'+sel+'"]').removeClass('notActive').addClass('active');
})

</html>




1 Answer
1



Add a same 'name' and 'value' identifier on each button tag.



Then just call the the name.



Example:


HTML:

<a class="btn btn-primary btn-sm active" name="WalkinDoor" value="-1">No Change</a>
<a class="btn btn-primary btn-sm notActive" name="WalkinDoor" value="0">Active</a>
<a class="btn btn-primary btn-sm notActive" name="WalkinDoor" value="1">1 Hour</a>


PHP:

$buttonValue = $_POST['WalkinDoor'];





I need to be able to change the values using the javascript in my code.
– Graham Ballard
Jun 30 at 3:21






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

Opening a url is failing in Swift

Export result set on Dbeaver to CSV