mikebyrne Posted March 22, 2008 Share Posted March 22, 2008 I want it to when the user selects "Show" the word YES will pass to the Display field in my databasae and f the user selects "Hide" the words NO will pass to the dispaly fields At present my PHP looks like <?PHP require_once("adminconnect.php"); $ProductNo = mysql_real_escape_string(trim($_POST['ProductNo'])); $ProductName = mysql_real_escape_string(trim($_POST['ProductName'])); $Description = mysql_real_escape_string(trim($_POST['Description'])); $Price = mysql_real_escape_string(trim($_POST['Price'])); $Stockamount = mysql_real_escape_string(trim($_POST['Stockamount'])); $Type = $_POST['Type']; $tbl_name="product"; $sql="INSERT INTO $tbl_name (Producttype, ProductNo, ProductName, Description,Price) VALUES ('$Type','$ProductNo', '$ProductName', '$Description', '$Price')"; mysql_query($sql); echo $_POST['ProductNo']; echo $_POST['ProductName']; echo $_POST['Description']; echo $_POST['Price']; echo $_POST['Stockamount']; echo $_POST['Type']; echo $sql; ?> <div class="editRightText">Display:</div> <div class="editRightForm"> <div class="editRadio1"> <input name="display" type="radio" value="yes" checked="checked" /> </div> <div class="editRadio2">show</div> <div class="editRadio3"> <input name="display" type="radio" value="no" /> Link to comment https://forums.phpfreaks.com/topic/97355-changing-radio-button-option-to-variable/ Share on other sites More sharing options...
mVeliki Posted March 22, 2008 Share Posted March 22, 2008 Is it enough ? .. $Disp = mysql_real_escape_string(trim($_POST['display'])); .. .. $sql="INSERT INTO $tbl_name (Producttype, ProductNo, ProductName, Description,Price,Display) VALUES ('$Type','$ProductNo', '$ProductName', '$Description', '$Price', '$Disp')"; .. .. echo $_POST['display']; Link to comment https://forums.phpfreaks.com/topic/97355-changing-radio-button-option-to-variable/#findComment-498224 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.