Skip to main content
J Cellini
Inspiring
January 27, 2013
Answered

radio button value not showing in mysql table

  • January 27, 2013
  • 1 reply
  • 1256 views

This seems like a small problem but I can't seem to find the solution. I created a form on a web page. After the form is filled out, a confirmation email is sent to the person who filled out the form and a mysql table is populated with the information from the form. Everything works good except for one little thing: the value of the radio button is not showing up in the table.

Here's the form: http://www.webdevpractice.com/genoptix/CE/register.php

Here's the table on the webpage: http://www.webdevpractice.com/genoptix/CE/admin/index.php You will see that the Contact Me column is not filling up.

Here the php insert code on the registration form page:

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "registration")) {

  $insertSQL = sprintf("INSERT INTO registrants (registrant_id, first_name, last_name, medtech_id, job_title, company, city, `state`, email, phone, contact) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",

                       GetSQLValueString($_POST['registrant_id'], "int"),

                       GetSQLValueString($_POST['first_name'], "text"),

                       GetSQLValueString($_POST['last_name'], "text"),

                       GetSQLValueString($_POST['medtech_id'], "text"),

                       GetSQLValueString($_POST['job_title'], "text"),

                       GetSQLValueString($_POST['company'], "text"),

                       GetSQLValueString($_POST['city'], "text"),

                       GetSQLValueString($_POST['state'], "text"),

                       GetSQLValueString($_POST['email'], "text"),

                       GetSQLValueString($_POST['phone'], "text"),

                       GetSQLValueString(isset($_POST['contact']) ? "true" : "", "defined","'Y'","'N'"));

I used phpMyAdmin to create the db and the table. I set the contact field as follows:

Type: ENUM

Lengths/Values: 'n','y'

Default: None

Collation: utf8_unicode_ci

Can you spot the problem?

This topic has been closed for replies.
Correct answer J Cellini

I found the problem. I hate to broadcast my stupidity but I at one point I changed the last field from contact_me to contact and I forgot to upload the change on one of the files (I thought I had uploading it). At any rate, thanks for responding to my post. It's good to know Altruistic Gramps abides!

1 reply

BenPleysier
Community Expert
Community Expert
January 28, 2013

GetSQLValueString(isset($_POST['contact']) ? "true" : "", "defined","'Y'","'N'"));

In your form, you have given the value as "Yes" and "No", yet in the database you have defined the value as "Y" and "N"

Personally, I would change the values in the form to correspond with those in the database.

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
J Cellini
J CelliniAuthorCorrect answer
Inspiring
January 28, 2013

I found the problem. I hate to broadcast my stupidity but I at one point I changed the last field from contact_me to contact and I forgot to upload the change on one of the files (I thought I had uploading it). At any rate, thanks for responding to my post. It's good to know Altruistic Gramps abides!