Jump to content

Archived

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

stephfa

HTML Radio button

Recommended Posts

Hello,

i've added a new page to a site called join_us.php. My client wants it similar to the contact page with 2 additions:

1. All customers to pick how they want to join (with options: Independent Consultants, Material Girl Hair Boutique Franchise, Join our Stylist Prefer Team)

2. Add phone number field.

 

I basically duplicated the contact.php file which that went well. Now I am just trying to add the additional fields with the join us options as radio buttons. Here are the extra lines I've added. Can some one help? What am I doing wrong.

 

 

short version of what I added...see attachment for full file

========================================================================================

* at top

 

//sf extras

$place = tep_db_prepare_input($HTTP_POST_VARS['join']);

$phone_number = tep_db_prepare_input($HTTP_POST_VARS['phone_number']);

if ($phone_number <> NULL){

$enquiry = 'Phone Number(include area code): ' . $phone_number . "\n\n" . tep_db_prepare_input($HTTP_POST_VARS['enquiry']);

}else{

$enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);

} // eof

 

*towards middle table echo

 

 

<!-- sf extras -->

<tr>

<td class="fieldKey"><div class="crosspiece95"></div><?php echo ENTRY_JOIN; ?></td>

<td class="fieldValue" width="100%"><?php echo tep_draw_input_field('join', '', 'class="radio"'); ?></td>

 

<?php echo '<input type="radio" name="join" value="Independent Consultants" /> Independent Consultants<br />'; ?>

<?php echo '<input type="radio" name="join" value="Material Girl Hair Boutique Franchise" />

Material Girl Hair Boutique Franchise<br />'; ?>

<?php echo '<input type="radio" name="join" value="Join our Stylist Prefer Team" /> Join our Stylist Prefer Team<br />'; ?>

</td>

</tr>

<tr>

<td class="fieldKey"><div class="crosspiece95"></div><?php echo ENTRY_PHONE_NUMBER; ?></td>

<td class="fieldValue" width="100%"><?php echo tep_draw_input_field('phone_number', '', 'class="input"'); ?></td>

</tr>

<!-- end of sf extras -->

 

 

 

full file

=========================================================================================

 

<?php

/*

$Id$

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2010 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_JOIN_US);

$current_page = FILENAME_JOIN_US;

 

if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send') && isset($HTTP_POST_VARS['formid']) && ($HTTP_POST_VARS['formid'] == $sessiontoken)) {

$error = false;

 

$name = tep_db_prepare_input($HTTP_POST_VARS['name']);

 

//sf extras

$place = tep_db_prepare_input($HTTP_POST_VARS['join']);

$phone_number = tep_db_prepare_input($HTTP_POST_VARS['phone_number']);

if ($phone_number <> NULL){

$enquiry = 'Phone Number(include area code): ' . $phone_number . "\n\n" . tep_db_prepare_input($HTTP_POST_VARS['enquiry']);

}else{

$enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);

} // eof

 

$email_address = tep_db_prepare_input($HTTP_POST_VARS['email']);

$enquiry = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);

 

if (!tep_validate_email($email_address)) {

$error = true;

 

$messageStack->add('join', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);

}

 

$actionRecorder = new actionRecorder('ar_join_us', (tep_session_is_registered('customer_id') ? $customer_id : null), $name);

if (!$actionRecorder->canPerform()) {

$error = true;

 

$actionRecorder->record(false);

 

$messageStack->add('join', sprintf(ERROR_ACTION_RECORDER, (defined('MODULE_ACTION_RECORDER_JOIN_US_EMAIL_MINUTES') ? (int)MODULE_ACTION_RECORDER_JOIN_US_EMAIL_MINUTES : 15)));

}

 

if ($error == false) {

tep_mail(STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SUBJECT, $enquiry, $name, $email_address);

 

$actionRecorder->record();

 

tep_redirect(tep_href_link(FILENAME_JOIN_US, 'action=success'));

}

}

 

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_JOIN_US));

 

require(DIR_WS_INCLUDES . 'template_top.php');

?>

<?php echo tep_draw_content_top();?>

 

<?php echo tep_draw_title_top();?>

<h1><?php echo HEADING_TITLE; ?></h1>

<?php echo tep_draw_title_bottom();?>

 

<?php

if ($messageStack->size('join') > 0) {

echo $messageStack->output('join');

}

if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'success')) {

?>

<div class="contentContainer">

<div class="contentPadd txtPage">

<?php echo TEXT_SUCCESS; ?>

 

<div class="buttonSet">

<span class="fl_right"><?php echo tep_draw_button_top()?><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', tep_href_link(FILENAME_DEFAULT)); ?><?php echo tep_draw_button_bottom()?></span>

</div>

 

</div>

</div>

<?php

} else {

?>

<?php echo tep_draw_form('join_us', tep_href_link(FILENAME_JOIN_US, 'action=send'), 'post', '', true); ?>

<div class="contentContainer">

<div class="contentPadd txtPage">

 

<table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="fieldKey"><div class="crosspiece95"></div><?php echo ENTRY_NAME; ?></td>

<td class="fieldValue" width="100%"><?php echo tep_draw_input_field('name', '', 'class="input"'); ?></td>

</tr>

 

 

<!-- sf extras -->

<tr>

<td class="fieldKey"><div class="crosspiece95"></div><?php echo ENTRY_JOIN; ?></td>

<td class="fieldValue" width="100%"><?php echo tep_draw_input_field('join', '', 'class="radio"'); ?></td>

 

<?php echo '<input type="radio" name="join" value="Independent Consultants" /> Independent Consultants<br />'; ?>

<?php echo '<input type="radio" name="join" value="Material Girl Hair Boutique Franchise" />

Material Girl Hair Boutique Franchise<br />'; ?>

<?php echo '<input type="radio" name="join" value="Join our Stylist Prefer Team" /> Join our Stylist Prefer Team<br />'; ?>

</td>

</tr>

<tr>

<td class="fieldKey"><div class="crosspiece95"></div><?php echo ENTRY_PHONE_NUMBER; ?></td>

<td class="fieldValue" width="100%"><?php echo tep_draw_input_field('phone_number', '', 'class="input"'); ?></td>

</tr>

<!-- end of sf extras -->

 

 

<tr>

<td class="fieldKey"><?php echo ENTRY_EMAIL; ?></td>

<td class="fieldValue"><?php echo tep_draw_input_field('email', '', 'class="input"'); ?></td>

</tr>

<tr>

<td class="fieldKey" valign="top"><?php echo ENTRY_ENQUIRY; ?></td>

<td class="fieldValue"><?php echo tep_draw_textarea_field('enquiry', 'soft', 50, 15); ?></td>

</tr>

 

</table>

 

<div class="buttonSet">

<span class="fl_right"><?php echo tep_draw_button_top()?><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', null, 'primary'); ?><?php echo tep_draw_button_bottom()?></span>

</div>

 

</div>

</div>

</form>

<?php

}

?>

<?php echo tep_draw_content_bottom();?>

 

<?php

require(DIR_WS_INCLUDES . 'template_bottom.php');

require(DIR_WS_INCLUDES . 'application_bottom.php');

?>

join_us.php

join_us.php

Share this post


Link to post
Share on other sites

i'm reattaching both because I almost got it figured out:

catalog/join_us.php

includes/language/english/join_us.php

 

Here is the link on the site to see the problem

http://www.materialgirlhairsalon.com/catalog/join_us.php

 

 

Everything is correct with the exception of the Join field. The radio buttons should be beside or below the join field instead of input. (customer wants visitors to select one of the three options : Independent Consultants, Material Girl Hair Boutique Franchise or Join our Stylist Prefer Team

join_us.php

join_us.php

Share this post


Link to post
Share on other sites

Never mind..Thanks to all who have viewed. I figured it out!! Problem fixed. Here is the final if someone else is having problems. Pure luck for me :D adding radio button to join us page..

on line 114 of the catalog/join_us.php

delete the following

<?php echo tep_draw_input_field('join', '', 'class="radio"'); ?>

Share this post


Link to post
Share on other sites

Okay I got too excited. Now I am getting the default error message when I submit form. The form looks good on the page but it's not working correctly. Suggestions?

 

see join_us.php attachments

The website link is http://www.materialgirlhairsalon.com/catalog/join_us.php

 

 

 

 

Error message

Error: An enquiry has already been sent. Please try again in 15 minutes.

Share this post


Link to post
Share on other sites

×