Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

Validate Form and Filename PHP

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Validate Form and Filename PHP

Postby Pritesh23 » Tue Sep 10, 2013 7:10 am

Hello,

I would like to solve form validation and filename problem.

Here is my code:

Code: Select all
/************************** 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??



Problems: :oops:

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 :help:
3. Input for Filename

Thanks in advanced for your time. :) :help:
Pritesh23
New php-forum User
New php-forum User
 
Posts: 25
Joined: Wed Jul 17, 2013 12:42 pm

Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 5 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron