Jump to content


Photo

Form and Filename PHP

form php passing_variable

  • Please log in to reply
3 replies to this topic

#1 PriteshP23

PriteshP23

    Advanced Member

  • Members
  • PipPipPip
  • 79 posts
  • Age:24

Posted 09 September 2013 - 11:00 AM

Hello,

 

I would like to solve form problem.  Here is my code:

/************************** Step 1: Select Cell************************************/

if(isset($_POST['SmartPhone']))
$checked1=$_POST['SmartPhone'];
$form->add_checkbox('SmartPhone','SmartPhone',$checked1);

if(isset($_POST['Apple']))
$checked2=$_POST['Apple'];
$form->add_checkbox('Apple','Apple',$checked2);

/************************** Step 2: Select Model************************************/	

if($_POST['SmartPhone']==false and $_POST['Apple']==false)
{
  $this->add(new error('<span style="color:red">Select your cell..!!</span>'));
  $this->step1();
  return;
}
if(isset($_POST['S4']))
  $tech2=$_POST['S4'];
$form->add_checkbox('S4','S4',$tech2);

if(isset($_POST['iPhone 5']))
  $tech3=$_POST['iPhone 5'];
$form->add_checkbox('iPhone_5','iPhone 5',$tech3);

if(isset($_POST['iPhone 5s']))
  $tech1=$_POST['iPhone 5s'];
$form->add_checkbox('iPhone_5s','iPhone 5s',$tech1);

//In addition, i want to know how to put "Select All" button here 
// in order to SELECT ALL MODELs: S4, iPhone 5, iPhone_5s
  
/************************** Step 3: File Generation************************************/	

if($_POST['S4']==false and $_POST['iPhone_5']==false and $_POST['iPhone_5s']==false)
{
  $this->add(new error('<span style="color:red">Please enter your model..!</span>'));
  $this->step2();
  return;
}

$date = date('Y-m-d_H-i-s');

// Filename should be like this format "cell_datetime.xml"
// For example: SmartPhone_20130910183023.xml or Apple_20130910183023.xml

// Any idea how to create such filename??

Thanks for your time. :)


Edited by PriteshP23, 09 September 2013 - 11:01 AM.

" I will Win not immediately, but Definitely. "

 


#2 PriteshP23

PriteshP23

    Advanced Member

  • Members
  • PipPipPip
  • 79 posts
  • Age:24

Posted 09 September 2013 - 04:27 PM

Problems: 

 

1. IF we don't select Model; it gives message for both to select again. It should ask ONLY for model. 

2. Input for Select All button 

3. Input for Filename

 

:facewall:  :rolleyes:


" I will Win not immediately, but Definitely. "

 


#3 priyankagound

priyankagound

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts

Posted 11 September 2013 - 07:24 AM

 

Here's an idea ........

 

<input class="checkbox-class" type="checkbox" value="1" /><input class="checkbox-class" type="checkbox" value="2" /> <input class="checkbox-class" type="checkbox" value="3" /> <input type="button" id="clickit" value="Check All" />

 

This will work to check all the values in the check box



#4 PriteshP23

PriteshP23

    Advanced Member

  • Members
  • PipPipPip
  • 79 posts
  • Age:24

Posted 11 September 2013 - 09:34 AM

This will work to check all the values in the check box

 

Thanks in advanced to give an example (if possible) of what you have said.

 

I am sorry but i didn't get you. How it will work in my code ?

 

I do not know how to apply your logic to get expected output.


" I will Win not immediately, but Definitely. "

 





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com