Jump to content

Using Variable as a Form Field Name


pasturepool

Recommended Posts

Hello,

 

I have a form that has 3 fields: 2 text fields, 1 checkbox.  I want to use a variable to define both the field NAME and default VALUE.  When it comes to the field NAME, here is what I've done:

<?php

$FIELDNAME = $_REQUEST['FGH']; //this changes based upon a URL variable

$VALUEXYZ = "ABC";

?>

 

<input name="<?php echo $FIELDNAME;?>" type="text" id="score"

                        value="<?php echo $VALUEXYZ;?>" size="4" maxlength="2" />

 

1. When looking at the 'input name', assuming this is correct, i'm having trouble passing this form field name to an UPDATE statement.  I'm not sure how to $_POST['???'] correctly the form field name?

 

If this made any sense to anyone out there, I am at a loss and appreciate your expertise!!!! ???

Link to comment
https://forums.phpfreaks.com/topic/93602-using-variable-as-a-form-field-name/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.