How to add radio button and Test schedule with date and time? - php

I had created the form with some details but I added the radio button and it is not working for getting the values to print on my mail and I have tried to add the date and time using dropdown list but it is not working fine.
the radio buttons should be required.It has to show as in below image as alert for radio button and Test schedule but it is not getting as in the image
Please any one help me.It is very important for me.
My form
<form action="http://www.labwise.in/devel/zensearch/order" id="bookingtest" method="post">
<div class="fieldset">
<ul class="form-list">
<li class="fields">
<div class="field">
<label for="testname" class="required"><em>*</em><?php echo $this->__('Test Name') ?> </label>
<div class="input-box">
<input type="text" id="testname" name="testname" value="<?php echo $_GET['name']?>" class="input-text required-entry" title="<?php echo $this->__('Test Name') ?>" />
</div>
</div>
<div class="field">
<label for="city" class="required"><em>*</em><?php echo $this->__('City') ?> </label>
<div class="input-box">
<input type="text" id="city" name="city" value="<?php echo $_GET['city']?>" class="input-text required-entry" title="<?php echo $this->__('City') ?>" />
</div>
</div>
</li>
<li>
<label for="location" class="required"><em>*</em><?php echo $this->__('Location') ?> </label>
<div class="input-box">
<input type="text" id="location" name="location" value="<?php echo $_GET['location']?>" class="input-text required-entry" title="<?php echo $this->__('Location') ?>" />
</div>
</li>
<li class="fields">
<div class="field">
<label for="cname" class="required"><em>*</em><?php echo $this->__('Name') ?> </label>
<div class="input-box">
<input type="text" id="cname" name="cname" value="" class="input-text required-entry" title="<?php echo $this->__('Name') ?>" />
</div>
</div>
<div class="field">
<label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
<div class="input-box">
<input type="text" name="email" value="<?php echo $this->escapeHtml($this->getUsername()) ?>" id="email" class="input-text required-entry validate-email" title="<?php echo $this->__('Email Address') ?>" />
</div>
</div>
</li>
<li>
<label for="mobile" class="required"><em>*</em><?php echo $this->__('Mobile Number') ?> </label>
<div class="input-box">
<input type="text" id="mobile" name="mobile" value="" class="input-text required-entry validate-mobileno" title="<?php echo $this->__('Mobile Number') ?>" />
</div>
</li>
<li>
<label class="required"><em>*</em><?php echo $this->__('Sample Collection') ?> </label></li>
<li>
<div class="radio_button">
<input type="radio" name="radio" class="input-text required-entry validate-select" value="I will visit Lab"> I will visit Lab
</div>
<div>
<input type="radio" name="radio" class="input-text required-entry validate-select" value="Visit me at home/office +Rs50.00" > Visit me at home/office +Rs50.00
</div>
</li>
<li>
<label for="requiredby" class="required"><em>*</em><?php echo $this->__('Test Schedule') ?> </label>
<div class="input-box">
<input type="text" id="requiredby" name="requiredby" value="" class="input-text required-entry" title="<?php echo $this->__('Test Schedule') ?>" style="width: 150px;" />
<img style="" title="Select Date" id="date_select_trig" alt="" src="<?php echo $this->getSkinUrl("images/calendar.gif");?> "/>
<select name="date_time" id="date_time" class="input-text required-entry validate-select" style="width: 50px;" />
<option value=""><?php echo $this->__('--')?></option>
<option value="1"><?php echo $this->__('1')?></option>
<option value="2"><?php echo $this->__('2')?></option>
<option value="3"><?php echo $this->__('3')?></option>
<option value="4"><?php echo $this->__('4')?></option>
<option value="5"><?php echo $this->__('5')?></option>
<option value="6"><?php echo $this->__('6')?></option>
<option value="7"><?php echo $this->__('7')?></option>
<option value="8"><?php echo $this->__('8')?></option>
<option value="9"><?php echo $this->__('9')?></option>
<option value="10"><?php echo $this->__('10')?></option>
<option value="11"><?php echo $this->__('11')?></option>
<option value="12"><?php echo $this->__('12')?></option>
</select>
<b>:</b>
</div>
</li>
</ul>
</div>
<div class="button">
<p class="required"><?php echo $this->__('* Required Fields') ?></p>
<button id= "submit" type="submit" class="button" title="<?php echo $this->__('Book Test') ?>" name="send" id="send2"><span><span><?php echo $this->__('Book Test') ?></span></span></button>
</div>
</form>
<script src="<?php echo Mage::getBaseUrl('js')."calendar/calendar.js" ?>" type="text/javascript"></script>
<script src="<?php echo Mage::getBaseUrl('js')."calendar/calendar-setup.js" ?>" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="<?php echo Mage::getBaseUrl('js') ?>calendar/calendar-win2k-1.css" />
<?php echo $this->getLayout()->createBlock('core/html_calendar')->setTemplate('page/js/calendar.phtml')->toHtml();?>
<script type="text/javascript">
if(Validation) {
Validation.addAllThese([
['validate-mobileno','Enter correct mobile number (Eg:9986858483)',
function(v){
//var timePat ="^((\+){0,1}91(\s){0,1}(\-){0,1}(\s){0,1}){0,1}9[0-9](\s){0,1}(\-){0,1}(\s){0,1}[1-9]{1}[0-9]{7}$";
var timePat ="^{0,1}9[0-9](\s){0,1}(\-){0,1}(\s){0,1}[1-9]{1}[0-9]{7}$";
// var matchArray = v.match(timePat);
if(v.length > 0){
if(v.length !=10){
return false;
}else if(v[0]!=9 && v[0]!=8 && v[0]!=7){
return false;
}
return true;
}else {
return false;
}
}
]])
};
var dataForm = new VarienForm('bookingtest', true);
</script>
<script type="text/javascript">
// <![CDATA[
Calendar.setup({
inputField : 'testschedule',
ifFormat : '%d-%b-%Y',
showsTime: false,
button : 'date_select_trig',
singleClick : true,
});
// ]]>
</script>

This is one way of getting rid of that deep level of nesting.
var visit = document.getElementById('visit-required');
var form = document.forms.bookingtest;
form.addEventListener('submit', function(e){
if(!form.lab.checked && form.office.checked){
e.preventDefault();
visit.style.display = 'block';
}
});
.marked-required{
color: #FF0000;
}
.message-required{
display: none;
color: #FF0000;
}
#options{
border: 2px solid #FF0000;
}
#datetime > input{
display: inline-block;
vertical-align: top;
}
Place this php in the file you want to post to.
/* example.php */
<?php
print_r($_POST);
?>
<form action="example.php" id="bookingtest" method="post">
<strong>Sample collection <span class='marked-required'>*</span></strong>
<div id='options'>
<input type='radio' name='visit' id='lab'/>I will visit Lab<br/>
<input type='radio' name='visit' id='office'/>Visit me at home/office + Rs50.00
</div>
<small class='message-required' id='visit-required'>Please select one of the option.</small>
<br/>
<strong>Test schedule<span class='marked-required'>*</span></strong>
<div id='datetime'>
<input type='text' />
<select>
<option>From</option>
</select>
<select>
<option>To</option>
</select>
<select>
<option>AM</option>
<option>PM</option>
</select>
<small class='message-required'>This is a required option</small>
</div>
<input type='submit' id='submit' value='Submit'/>
</form>

Related

Form sometimes submitting data, sometimes not. Magento 1.9

I have a page where I call a form, receiving reports from users that sometimes it just doesn't submit properly. Not sure why. Any ideas?
Users have been reporting this in various browsers, so it's been especially difficult to track down. Chrome, IE, Edge, Safari, etc. have all reported it, but sometimes it just works.
What the form is supposed to do is take the entered data, then email it to a specific email address.
Magento Block:
<div class="page-title">
<h1>Program</h1>
</div>
<img class="textwrap-right" src="{{media url="wysiwyg/cfi_rebate_badge.png"}}" alt="" />
<div class="std">
<h3 class="ui-helper-clearfix">Sign up below.</h3>
{{widget type="mailform/widget_form" form_template="contacts/cfi.phtml"}}<br />
</div>
This is my contacts/cfi.phtml template:
<?php
$directory = Mage::helper('directory');
$customer = Mage::getSingleton('customer/session')->getCustomer();
$customerAddress = $customer->getAddressById( $customer->getDefaultBilling() );
if($customerAddress->getCountryId() != 'US'){
$customerAddress = Mage::getModel('customer/address');
}
?>
<div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
<form action="<?php echo $this->getFormAction() ?>" id="contactForm" method="post" class="scaffold-form">
<div class="fieldset">
<h2 class="legend"><?php echo Mage::helper('contacts')->__('Contact Information') ?></h2>
<p class="required"><?php echo Mage::helper('contacts')->__('* Required Fields') ?></p>
<ul class="form-list">
<li class="fields">
<div class="field">
<label for="cfirebate:name" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Name') ?></label>
<div class="input-box">
<input name="cfirebate[name]" id="cfirebate:name" title="<?php echo Mage::helper('contacts')->__('Name') ?>" value="<?php echo $this->escapeHtml($this->helper('contacts')->getUserName()) ?>" class="input-text required-entry" type="text" />
</div>
</div>
<input type="hidden" name="cfirebate[country]" id="cfirebate:country_id" value="US">
<div class="field">
<label for="cfirebate:address" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Address') ?></label>
<div class="input-box">
<input name="cfirebate[address]" id="cfirebate:address" title="<?php echo Mage::helper('contacts')->__('Address') ?>" class="input-text required-entry" type="text" />
</div>
</div>
<div class="field">
<label for="cfirebate:city" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('City') ?></label>
<div class="input-box">
<input name="cfirebate[city]" id="cfirebate:city" title="<?php echo Mage::helper('contacts')->__('City') ?>" class="input-text required-entry" type="text" />
</div>
</div>
<div class="field">
<div class="field">
<label for="cfirebate:region" class="required"><em>*</em><?php echo $this->__('State/Province') ?></label>
<div class="input-box">
<select id="cfirebate:region_id" name="cfirebate[region_id]" title="<?php echo $this->__('State/Province') ?>" class="validate-select" style="display:none;">
<option value="">Please select region, state or province</option>
</select>
</div>
</div>
</div>
<div class="field">
<label for="cfirebate:postcode" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Zip') ?></label>
<div class="input-box">
<input name="cfirebate[postcode]" id="cfirebate:postcode" title="<?php echo Mage::helper('contacts')->__('Zip') ?>" class="input-text required-entry" type="text" />
</div>
</div>
<div class="field">
<label for="cfirebate:email" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Email') ?></label>
<div class="input-box">
<input name="cfirebate[email]" id="cfirebate:email" title="<?php echo Mage::helper('contacts')->__('Email') ?>" class="input-text required-entry validate-email" type="email" autocapitalize="off" autocorrect="off" spellcheck="false" />
</div>
</div>
</li>
<li>
<label for="cfirebate:telephone"><?php echo Mage::helper('contacts')->__('Phone Number') ?></label>
<div class="input-box">
<input name="cfirebate[telephone]" id="cfirebate:telephone" title="<?php echo Mage::helper('contacts')->__('Phone Number') ?>" class="input-text" type="tel" />
</div>
</li>
<li class="wide">
<label for="cfirebate:comment"><?php echo Mage::helper('contacts')->__('Comment') ?></label>
<div class="input-box">
<textarea name="cfirebate[comment]" id="cfirebate:comment" title="<?php echo Mage::helper('contacts')->__('Comment') ?>" class="input-text" cols="5" rows="3"></textarea>
</div>
</li>
</ul>
</div>
<div class="buttons-set">
<input type="text" name="hideit" id="hideit" value="" style="display:none !important;" />
<button type="submit" title="<?php echo Mage::helper('contacts')->__('Submit') ?>" class="button"><span><span><?php echo Mage::helper('contacts')->__('Submit') ?></span></span></button>
</div>
</form>
<script type="text/javascript">
//<![CDATA[
var contactForm = new VarienForm('contactForm', true);
var cfiRegionUpdater = new RegionUpdater('cfirebate:country_id', 'cfirebate:region', 'cfirebate:region_id', <?php echo $directory->getRegionJson() ?>, undefined, 'cfirebate:postcode');
//]]>
</script>
Try adding form key inside the form:
<input type="hidden" name="form_key" value="<?php echo $this->getFormKey(); ?>">
Just add the above code anywhere inside your form markup.

checkbox doesnt have a value php

I'm trying to turn a input into a checkbox on my form. When checked I want the value to be 1 and unchecked to be zero. I tried a few things but on submit the value doesnt get added into the db.
HTML-1:
<div class="col-sm-5 col-sm-push-1 form-group required">
<label class="control-label" for="input-active"><?php echo $entry_active; ?></label>
<div class="input-active required">
<input type="checkbox" name="active" value="0" placeholder="<?php echo $text_active; ?>" id="input-active" class="form-control" />
</div>
<?php if (isset($error_date_starting)) { ?>
<label class="text-danger"><?php echo $error_code; ?></label>
<?php } ?>
</div>ut type="checkbox" name="active" value="0" placeholder="<?php echo $text_active; ?>" id="input-active" class="form-control" />
</div>
<?php if (isset($error_date_starting)) { ?>
<label class="text-danger"><?php echo $error_code; ?></label>
<?php } ?>
</div>
HTML-2:
<div class="col-sm-5 col-sm-push-1 form-group required">
<label class="control-label" for="input-active"><?php echo $entry_active; ?></label>
<div class="input-active required">
<input type="hidden" name='active' value='0' placeholder="<?php echo $text_active; ?>" id="input-active" class="form-control" />
<input type="checkbox" name='active' value='1' placeholder="<?php echo $text_active; ?>" id="input-active" class="form-control" />
</div>
<?php if (isset($error_date_starting)) { ?>
<label class="text-danger"><?php echo $error_code; ?></label>
<?php } ?>
</div>
I tried a few Javascripts solutions but none worked:
<script type="text/javascript">
$('#input-active').on('change', function(){
this.value = this.checked ? 1 : 0;
// alert(this.value);
}).change();
</script>
UPDATE!!
Still not working I've changed code following suggestions still not doing what I'd like.
New HTML:
<div class="col-sm-5 col-sm-push-1 form-group required">
<label class="control-label" for="input-active"><?php echo $entry_active; ?></label>
<div class="input-active required">
<input type="checkbox" name='active' value='0' placeholder="<?php echo $text_active; ?>" id="input-active" class="form-control" />
</div>
<?php if (isset($error_date_starting)) { ?>
<label class="text-danger"><?php echo $error_code; ?></label>
<?php } ?>
</div>
New JS:
<script type="text/javascript">
$("#input-active").change(function() {
if(this.checked) {
$("#input-active").val('1');
} else {
$("#input-active").val('0');
}
});
</script>
To catch the toggled event on input type please use the following function
$("#input-active").change(function() {
if($(this).is(':checked')) {
console.log('checked')
$(this).val(1);
} else {
console.log('un checked')
$(this).val(0);
}
console.log($(this).val())
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="col-sm-5 col-sm-push-1 form-group required">
<label class="control-label" for="input-active">In active</label>
<div class="input-active required">
<input type="checkbox" name='active' value='0' placeholder="Active" id="input-active" class="form-control" />
</div>
</div>

Custom contact form: Unable to submit your request. Please, try again later

I created a new contact form in:
app/design/frontend/base/default/template/contacts
Named form2.phtml
I am getting the error: Unable to submit your request. Please, try again later.
Here's my code:
<div id="messages_product_view"><?php echo $this->getMessagesBlock()->toHtml() ?></div>
<h2>Questions? Comments?<br>
Contact us here and we’ll get back to you shortly.</h2>
<form action="<?php echo $this->getFormAction(); ?>" id="contactForm2" class="footer-form" method="post">
<div class="fieldset">
<ul class="form-list">
<div class="form-row">
<li>
<div class="input-box">
<input placeholder="First Name *" name="first name" id="name" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('First Name')) ?>" value="<?php echo $this->escapeHtml($this->helper('contacts')->getUserName()) ?>" class="input-text required-entry" type="text" />
</div>
</li>
<li>
<div class="input-box">
<input placeholder="Last Name *" name="last name" id="name" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Last Name')) ?>" value="<?php echo $this->escapeHtml($this->helper('contacts')->getUserName()) ?>" class="input-text required-entry" type="text" />
</div>
</li>
</div>
<div class="form-row">
<li>
<div class="input-box">
<input placeholder="Email *" name="email" id="email" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Email')) ?>" value="<?php echo $this->escapeHtml($this->helper('contacts')->getUserEmail()) ?>" class="input-text required-entry validate-email" type="text" />
</div>
</li>
<li>
<div class="input-box">
<input placeholder="Telephone" name="telephone" id="telephone" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Telephone')) ?>" value="" class="input-text" type="text" />
</div>
</li>
</div>
<li class="wide">
<div class="input-box">
<textarea placeholder="Message *" name="comment" id="comment" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Comment')) ?>" class="required-entry input-text" cols="5" rows="3"></textarea>
</div>
</li>
</ul>
</div>
<div class="buttons-set">
<input type="text" name="hideit" id="hideit" value="" style="display:none !important;" />
<button type="submit" title="<?php echo Mage::helper('core')->quoteEscape(Mage::helper('contacts')->__('Submit')) ?>" class="button"><span><span><?php echo Mage::helper('contacts')->__('SEND') ?></span></span></button>
</div>
</form>
<script type="text/javascript">
//<![CDATA[
var contactForm = new VarienForm('contactForm', true);
//]]>
</script>
Any ideas what would be causing this? The default form works fine when I switch it back to it. Did I miss a step somewhere?
Thanks
Since you have the "hideit" input added, commented out
if (Zend_Validate::is(trim($post[’hideit’]), ‘NotEmpty’)) {
$error = true;
}
inside app/code/core/Mage/contacts/controllers/indexController.php

Codeigniter url redirection

I am developing an application on codeigniter whenever i try to visit the business controller it redirects to login page. This is the url http://www.atms.com.au/index.php/business. I cant find where the check for session variable is made for login
This is the controller
<?php
class Business extends Controller
{
function Business()
{
parent::Controller();
$this->load->model('members_model');
}
function index()
{
$this->session->set_userdata( $this->session_name, true) ;
$this->session->set_userdata( "atms_member_login_id", $this->login_id);
if($this->input->post('submit_business_info'))
{
$business_name = $data['business_name'] = $this->input->post('business_name');
$data['business_description'] = $this->input->post('description');
$data['status'] = '1';
if($_FILES['business_logo']['name'])
{
$prev_image = $this->input->post('prev_image');
$logo = upload_image('business_logo', $this->config->item('business_logo_root'), array('dest' => $this->config->item('business_logo_root'), 'size' => array('w' => 127, 'h' => 127), 'ratio' => false), $prev_image);
if($logo)
$data['business_logo'] = $logo;
else
$data['business_logo'] = $prev_image;
}
$this->general_db_model->update('atms_members_info_tmp', $data, 'member_id = '.member_id());
$member_detail = $this->general_db_model->getMemberDetail('atms_members_info', member_id());
//debug_array($member_detail);
$clinics = $this->input->post('clinic');
if(!empty($clinics))
{
foreach($clinics as $key=>$clinic)
{
if(array_values_exist($clinic))
{
if($clinic_id = $clinic['clinic_id'])
{
unset($clinic['clinic_id']);
$this->general_db_model->update('atms_members_clinic_info_tmp', $clinic, 'clinic_id = '.$clinic_id);
$data['provider_no'] = 'updated';
$this->general_db_model->update('atms_members_info_tmp', $data, 'member_id = '.member_id());
}
else
{
$clinic['member_id'] = member_id();
$this->general_db_model->insert('atms_members_clinic_info_tmp', $clinic);
$data['provider_no'] = 'updated';
$this->general_db_model->update('atms_members_info_tmp', $data, 'member_id = '.member_id());
}
}
}
$link = site_url()."/admin/members/update_details/".$member_detail->id;
$message = '';
$message.= 'Dear '.$business_name.',<br/><br/>';
$message.= $business_name.' had update business listing. So please approve it.<br/>';
$message.= " Link: <a href='".$link."' > Update Link</a><br/>";
$message.= 'Thank You.<br/>';
$subject = "Approve Update business listing.";
//$to = $this->settings->item('admin_email');
$to = $this->settings->item('admin_email');
$from =$member_detail->email;
//die($message);
$header = config_item('project_title');
$this->my_library->send_email($to , $subject, $message, $header, $from);
}
$this->session->set_flashdata('success_message', 'Your business details successfully updated. Note: your updates must be approved by the administrator before displaying on the site.');
redirect(current_url());
die();
}
$data['info'] = $this->members_model->get_member_details(member_id());
$data['clinics'] = $this->members_model->get_member_clinics(member_id());
$this->load->view('site/member/business_v', $data);
}
}
?>
and this is the view
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php $this->load->view('site/inc/head');?>
</head>
<body>
<div id="wrapper">
<div id="headerWrapper">
<div id="header">
<div class="top">
<?php $this->load->view('site/inc/header');?>
</div>
<div id="menu">
<?php $this->load->view('site/inc/menu');?>
</div>
<div id="bannerIn" class="">
<h1>Update My Details</h1>
</div>
</div>
</div>
<!-- end #header -->
<div id="pageWrapper">
<div id="page" class="clf">
<div id="content">
<div class="wideForm">
<?php
global_message();
?>
<form method="post" enctype="multipart/form-data" id="businessForm" name="businessForm">
<ul class="clf">
<li>
<label>Business Name</label>
<div class="inpWrapwide">
<input type="text" class="text" name="business_name" id="business_name" value="<?php echo $info->business_name;?>" />
</div>
</li>
<li>
<label>Add Logo</label>
<div class="inpWrap file">
<input type="file" name="business_logo" id="addlogo" value="<?php echo $info->business_logo;?>" />
<input type="hidden" name="prev_image" value="<?php echo $info->business_logo;?>" />
</div>
<div style="padding:5px;"><em><?php echo $info->business_logo;?></em></div>
</li>
<li>
<label>Description</label>
<div class="txtWrap">
<textarea name="description" rows="4" cols="60"><?php echo $info->business_description;?></textarea>
</div>
</li>
<?php
$count = 1;
if(count($clinics) > 0) :
foreach($clinics as $key=>$clinic):
?>
<div id="clinic_<?php echo $count;?>">
<li>
<h3 style="float:left;">Clinic <?php echo $key+1;?></h3>
<input type="hidden" name="clinic[<?php echo $count;?>][clinic_id]" value="<?php echo $clinic->clinic_id;?>" />
<span style="padding-left:10px;"><img src="<?php echo config_item('site_images');?>close.gif" /></span>
</li>
<li class="split">
<dl class="clf">
<dd>
<label>Address 1</label>
<div class="inpWrap">
<input type="text" class="text" name="clinic[<?php echo $count;?>][clinic_address_1]" value="<?php echo $clinic->clinic_address_1;?>" />
</div>
</dd>
<dd class="lastItem">
<label>Address 2</label>
<div class="inpWrap">
<input type="text" class="text" name="clinic[<?php echo $count;?>][clinic_address_2]" value="<?php echo $clinic->clinic_address_2;?>" />
</div>
</dd></dl>
</li>
<li class="split">
<dl class="clf">
<dd>
<label>Suburb</label>
<div class="inpWrap">
<input type="text" class="text" name="clinic[<?php echo $count;?>][clinic_suburb]" value="<?php echo $clinic->clinic_suburb;?>" />
</div>
</dd>
<dd class="lastItem">
<label>State</label>
<?php echo select_states('clinic['.$count.'][clinic_state_id]', $clinic->clinic_state_id);?>
</dd></dl>
</li>
<li class="split">
<dl class="clf">
<dd>
<label>Postcode</label>
<div class="inpWrap">
<input type="text" class="text" name="clinic[<?php echo $count;?>][clinic_postcode]" value="<?php echo $clinic->clinic_postcode;?>" />
</div>
</dd>
<dd class="lastItem">
<label>Phone</label>
<div class="inpWrap">
<input type="text" class="text" name="clinic[<?php echo $count;?>][clinic_telephone]" value="<?php echo $clinic->clinic_telephone;?>" />
</div>
</dd></dl>
</li>
<li class="split">
<dl class="clf">
<dd>
<label>Mobile</label>
<div class="inpWrap">
<input type="text" class="text" name="clinic[<?php echo $count;?>][clinic_mobile]" value="<?php echo $clinic->clinic_mobile;?>" />
</div>
</dd>
<dd class="lastItem">
<label>Email</label>
<div class="inpWrap">
<input type="text" class="text" name="clinic[<?php echo $count;?>][clinic_email]" value="<?php echo $clinic->clinic_email;?>" />
</div>
</dd></dl>
<dl class="clf">
<dd>
<label>Website</label>
<div class="inpWrap">
<input type="text" class="text" name="clinic[<?php echo $count;?>][clinic_website]" value="<?php echo $clinic->clinic_website;?>" />
</div>
</dd>
</dl>
</li>
</div>
<?php $count++; endforeach; ?>
<?php else:
?>
<div>
<li>
<h3>Clinic 1</h3>
</li>
<li class="split">
<dl class="clf">
<dd>
<label>City</label>
<div class="inpWrap">
<input type="text" class="text" name="clinic[<?php echo $count;?>][clinic_address_1]" value="" />
</div>
</dd>
<dd class="lastItem">
<label>State</label>
<div class="inpWrap">
<?php echo select_states('clinic['.$count.'][clinic_state_id]');?>
</div>
</dd></dl>
</li>
<li class="split">
<dl class="clf">
<dd>
<label>Postcode</label>
<div class="inpWrap">
<input type="text" class="text" name="clinic[<?php echo $count;?>][clinic_postcode]" value="" />
</div>
</dd>
<dd class="lastItem">
<label>Phone</label>
<input type="text" class="text" name="clinic[<?php echo $count;?>][clinic_telephone]" value="" />
</dd></dl>
</li>
<li class="split">
<dl class="clf">
<dd>
<label>Mobile</label>
<div class="inpWrap">
<input type="text" class="text" name="clinic[<?php echo $count;?>][clinic_mobile]" value="" />
</div>
</dd>
<dd class="lastItem">
<label>Email</label>
<div class="inpWrap">
<input type="text" class="text" name="clinic[<?php echo $count;?>][clinic_email]" value="" />
</div>
</dd></dl>
</li>
<li class="split">
<dl class="clf">
<dd>
<label>Website</label>
<div class="inpWrap">
<input type="text" class="text" name="clinic[<?php echo $count;?>][clinic_website]" value="" />
</div>
</dd>
</dl>
</li>
</div>
<?php $count++;?>
<?php endif; ?>
<div id="new_clinics">
<!--appends new clinics here-->
</div>
</ul>
<input type="button" class="add_clinic" value="Add more clinic" name="add_clinic" />
<div class="buttons clf">
<input type="button" class="cancel" value="cancel" onclick="window.location = '<?php echo current_url();?>';" />
<input type="submit" class="update" value="update" name="submit_business_info" />
</div>
</form>
</div>
</div>
<!-- end #content -->
<div id="sidebar">
<?php $this->load->view('site/inc/login_sidebar');?>
</div>
<!-- end #sidebar -->
</div>
</div>
<!-- end #page -->
</div>
<div id="footerWrapper">
<div id="footer">
<?php $this->load->view('site/inc/footer');?>
</div>
</div>
<!-- end #footer -->
<textarea style="display:none;" id="template">
<div class="transform" id="clinic_{0}">
<li>
<h3 style="float:left;">Clinic {0}</h3>
<span style="padding-left:10px;"><img src="<?php echo config_item('site_images');?>close.gif" /></span>
</li>
<li class="split">
<dl class="clf">
<dd>
<label>City</label>
<div class="inpWrap">
<input type="text" class="text" name="clinic[{0}][clinic_address_1]" value="" />
</div>
</dd>
<dd class="lastItem">
<label>State</label>
<div class="inpWrap">
<?php echo select_states('clinic[{0}][clinic_state_id]');?>
</div>
</dd></dl>
</li>
<li class="split">
<dl class="clf">
<dd>
<label>Postcode</label>
<div class="inpWrap">
<input type="text" class="text" name="clinic[{0}][clinic_postcode]" value="" />
</div>
</dd>
<dd class="lastItem">
<label>Phone</label>
<div class="inpWrap">
<input type="text" class="text" name="clinic[{0}][clinic_telephone]" value="" />
</div>
</dd></dl>
</li>
<li class="split">
<dl class="clf">
<dd>
<label>Mobile</label>
<div class="inpWrap">
<input type="text" class="text" name="clinic[{0}][clinic_mobile]" value="" />
</div>
</dd>
<dd class="lastItem">
<label>Email</label>
<div class="inpWrap">
<input type="text" class="text" name="clinic[{0}][clinic_email]" value="" />
</div>
</dd></dl>
</li>
<li class="split">
<dl class="clf">
<dd>
<label>Website</label>
<div class="inpWrap">
<input type="text" class="text" name="clinic[{0}][clinic_website]" value="" />
</div>
</dd>
</dl>
</li>
</textarea>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('.bannerLinks a').wrapInner('<span></span>');
$("input[type=file]").filestyle({
image: "<?php echo config_item('site_images');?>browse.gif",
imageheight : 22,
imagewidth : 68,
width : 250
});
jQuery('.file div').hover(function(){
//var _b = jQuery(this).attr("background");
//jQuery(this).css("background","<?php echo config_item('site_images');?>browse_h.gif");
}, function(){
//jQuery(this).css("background","<?php echo config_item('site_images');?>browse.gif");
});
$("#businessForm").validate();
var template = jQuery.format($("#template").val());
function addClinic() {
$(template(i++)).appendTo("div#new_clinics");
$('div.transform').jqTransform({imgPath:'<?php echo config_item('site_asset');?>jqtransform/img/'});
}
var i = <?php echo $count;?>;
$(".add_clinic").click(addClinic);
});
function removeClinic(index, cid)
{
if(cid)
{
if(confirm('Are You Sure?'))
{
$.post('<?php echo admin_url('members/remove_clinic_tmp');?>', {clinic_id : cid}, function(data){});
}
else
return false;
}
$('div#clinic_'+index).remove();
}
</script>
</body>
</html>
I am frustrated finding where the login check is made.
can anyone help me
Thanks
My suggestion is to go and have a look into the main Controller in the application/core. Maybe the Controller class is extended right there. Moreover, as it was also said, convert the old-style constructor to PHP 5+ __construct(). Try to set some breakpoints into your application to see where it goes and where it doesn't. I think that it should be related to an extension to the core controller.

How do i add two more sections to 'UPLOAD' attachments?

just wondering if anyone could help me please, i am trying to add two more more sections on our corporate site which will allow us to have people uploading more than one attachments. Could anyone help please?
<?php
/**
* #package
* #copyright Copyright (c)2010
* #license GNU General Public License version 2, or later
*/
defined('_JEXEC') or die('Restricted access'); // {}
if($this->config->allow_unsolicited == 0) die(JText::_('UNSOLAPPL_NOT_ALLOWED'));
?>
<?php $layout = JRequest::getVar('lyt', ''); ?>
<?php if($this->errors > 0) : ?>
<?php $option='com_jobboard'; $app= JFactory::getApplication(); ?>
<?php $fields = $app->getUserState('fields'); ?>
<?php endif; ?>
<?php $req_marker = '*'; ?>
<?php $path = 'index.php?option='. $option.'&view=upload&task=uload'; ?>
<form method="post" action="<?php echo JRoute::_($path); ?>" id="applFRM" name="applFRM" enctype="multipart/form-data">
<div id="aplpwrapper">
<?php echo JText::_('UPLOAD_CV_RESUME'); ?>
<h3><?php echo JText::_('UNSOLICITED_SUBMISSION'); ?></h3>
<div id="contleft">
<p><strong><?php echo JText::_('NOTE') ?>: </strong><?php echo JText::_('UNSOLICITED_CV_NOTIFICATION'); ?></p>
<div class="controw">
<label for="first_name"><?php echo JText::_('FIRSTNAME'); ?><span class="fieldreq"><?php echo $req_marker; ?></span></label>
<input class="inputfield " maxlength="20" id="first_name" name="first_name" size="50" value="<?php echo ($this->errors > 0)? $fields->first_name: ''; ?>" type="text" />
</div>
<div class="controw">
<label for="last_name"><?php echo JText::_('LASTNAME'); ?><span class="fieldreq"><?php echo $req_marker; ?></span></label>
<input class="inputfield " maxlength="20" id="last_name" name="last_name" size="50" value="<?php echo ($this->errors > 0)? $fields->last_name: ''; ?>" type="text" />
</div>
<div class="controw">
<label for="email"><?php echo JText::_('EMAIL_ADDRESS'); ?><span class="fieldreq"><?php echo $req_marker; ?></span></label>
<input class="inputfield " maxlength="50" id="email" name="email" size="50" value="<?php echo ($this->errors > 0)? $fields->email: ''; ?>" type="text" />
</div>
<div class="controw">
<label for="tel"><?php echo JText::_('TELEPHONE'); ?><span class="fieldreq"><?php echo $req_marker; ?></span></label>
<input class="inputfield " maxlength="50" id="tel" name="tel" size="50" value="<?php echo ($this->errors > 0)? $fields->tel: ''; ?>" type="text" />
</div>
<div class="controw">
<label for="title"><?php echo JText::_('CV_RESUME_TITLE'); ?><span class="fieldreq"><?php echo $req_marker; ?></span></label>
<input class="inputfield " id="title" name="title" size="50" maxlength="50" value="<?php echo ($this->errors > 0)? $fields->title: ''; ?>" type="text" />
</div>
<div class="rowsep"> </div>
<div class="controw">
<div class="uplrow">
<label for="cv"><?php echo JText::_('CV_RESUME'); ?><span class="fieldreq"><?php echo $req_marker; ?></span></label>
<input class="inputfield " maxlength="199" name="cv" id="cv" size="38" type="file" />
</div>
<div id="fslabel">
<small><strong><?php echo JText::_('NB'); ?>:</strong><?php echo ' '.JText::_('UPLOAD_ONLY_FORMATTYPES'); ?></small>
</div>
</div>
<div class="rowsep"> <h4><?php echo JText::_('OPTIONAL') ?></h4>
<label for="cover_text"><?php echo JText::_('COVER_NOTE') ?></label> <br /><small><?php echo JText::_('COVER_NOTE_HINT'); ?>:</small>
<textarea rows="4" id="cover_text" cols="" name="cover_text" style="float: right; margin-right: 12%; width: 47%;padding-top:5px" ><?php echo ($this->errors > 0)? $fields->cover_note: ''; ?></textarea>
</div>
<div align="center" style="clear: both; padding-top: 15px">
<span id="loadr" class="hidel"></span><input id="submit_application" name="submit_application" value=" <?php echo JText::_('SUBMIT_APPLICATION') ?> " class="button" type="Submit">
<?php $show_list='index.php?option='. $option.'&view=list&catid=1&lyt='.$layout; ?>
<?php echo JText::_('BACK'); ?>
</div>
</div>
</div>
<input name="form_submit" value="submitted" type="hidden">
<input name="catid" value="<?php echo $this->catid; ?>" type="hidden">
<?php echo JHTML::_('form.token'); ?>
</form>
<?php echo $this->setstate; ?>
Just duplicate code from line 45 to line 53:
<div class="controw">
<div class="uplrow">
<label for="cv"><?php echo JText::_('CV_RESUME'); ?><span class="fieldreq"><?php echo $req_marker; ?></span></label>
<input class="inputfield " maxlength="199" name="cv" id="cv" size="38" type="file" />
</div>
<div id="fslabel">
<small><strong><?php echo JText::_('NB'); ?>:</strong><?php echo ' '.JText::_('UPLOAD_ONLY_FORMATTYPES'); ?></small>
</div>
</div>
as many time as you need (eg 2).
and change
name="cv"
to
name="cv[]"
Then when you process submit just use $_FILES['cv'] as array.
For details see official PHP documentation:
http://php.net/manual/en/features.file-upload.multiple.php

Categories