Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Code help for a form


tetrad

Recommended Posts

Posted

I was hoping someone could help me phrase this code properly. I would like to have an html variable called username that will be submitted in a form set equal to the PHP variable $customer['customers_username']. This way I can hard code the persons username into the form when it submits.

 

I tried a define ('username', '$customer['customers_username']'); but that didnt work.

 

Could someone tell me the proper way to code this please.

 

Thanks!

Sean.

Posted

use the tep_draw_input_field function. Check the create_account.php script to see how it is used

 

				<td class="main"><?php echo tep_draw_input_field('firstname') . ' ' . (tep_not_null(ENTRY_FIRST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_FIRST_NAME_TEXT . '</span>': ''); ?></td>

When the form is submitted within the action switch you could pass the variable from the $HTTP_POST_VARS['firstname'] to wherever you need to.

Posted
use the tep_draw_input_field function. Check the create_account.php script to see how it is used

 

				<td class="main"><?php echo tep_draw_input_field('firstname') . ' ' . (tep_not_null(ENTRY_FIRST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_FIRST_NAME_TEXT . '</span>': ''); ?></td>

When the form is submitted within the action switch you could pass the variable from the $HTTP_POST_VARS['firstname'] to wherever you need to.

 

 

Mark,

 

Thank you for the reply. I probably didn't state my problem in the correct way. I actually already have the username of the person because they have to be logged in to use the form. I don't want them to enter anything. I will just echo out $customer['customers_username'] where the name field is. My problem is, how do I pass $customer['customers_username'] to the html variable 'username' so when they hit submit their name variable goes with all the other data they enter?

Posted

The 2nd parameter of the tep_draw_input_field function contains the default value. Use that and pass the varible to it. The first name of a customer is already a session with osc and it is available once the log-in. You could try this code

 

tep_draw_input_field('name', $customers_firstname);

 

To retrieve other customer's info you could use the database customers related tables.

Posted
The 2nd parameter of the tep_draw_input_field function contains the default value. Use that and pass the varible to it. The first name of a customer is already a session with osc and it is available once the log-in. You could try this code

 

tep_draw_input_field('name', $customers_firstname);

 

To retrieve other customer's info you could use the database customers related tables.

 

 

Genius as always Mark, thanks!

 

Here is the code I ended up using if anyone else finds it useful:

 

<span class="mainheader">Username:</span></br>

<?php echo tep_draw_input_field('username', $customer['customers_username'],'class="inputBox" size="35"'); ?>

</p>

<p></p>

 

<span class="mainheader">Email:</span></br>

<?php echo tep_draw_input_field('useremail', $customer['customers_email_address'],'class="inputBox" size="50"'); ?>

</p>

Archived

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

×
×
  • Create New...