Jump to content

Using input with a variable name tag


scottiesr1

Recommended Posts

:shrug:

 

I am attempting to send a form with the input as submit. I want the input name to be a variable so I can distinguish where this input is sent from and act accordingly in when processing the input.

 

I can't seem to get this variable name to change and I only get the actual variable name to be sent instead of the value of the variable. The variable I am trying to send is mem_or_ven. "$mem_or_ven", the name is literal: $mem_or_ven. If I leave out the quotes, no luck, either. I would appreciate any help!!

 

Here is my code:

 

<?php

if (isset($_POST["member_x"])) {

$mem_or_ven = "member"; }

 

?>

<form id="loginForm" name="loginForm" method="post" action="register-exec.php">

<table width="300" border="0" align="center" cellpadding="2" cellspacing="0">

<tr>

<th>First Name </th>

<td><input name="fname" type="text" class="textfield" id="fname" /></td>

</tr>

<tr>

<th>Last Name </th>

<td><input name="lname" type="text" class="textfield" id="lname" /></td>

</tr>

<td> </td>

<td><input name="$mem_or_ven" type="submit" name="Submit" value="Register" /></td>

</tr>

</table>

</form>

 

 

THX!

Link to comment
https://forums.phpfreaks.com/topic/240200-using-input-with-a-variable-name-tag/
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.