Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 25-08-2008
Member
 
Join Date: May 2008
Posts: 27
How to reload form

Hi All
I am creating a simple web site which will display user ads, so I have some forms they submit, here is a snippet of the code:
Code:
<div class="createlisting">

<div class="clinput">
Ad Title... (up to 100 characters)<br>
<?php
print '<input type="text" name="item_title"';
print s_att("item_title","value",100);
if (isset($err["item_title_err"]))
{print ' class="err"> '.$err["item_title_err"];}
else
{print '>';}
?>
<br>
</div>
I need to get users to agree to my terms and conditions, so something like:

if //checkbox they can click to agree else // if unchecked, reload the same form...
Not sure how to do this, can anyome help?
Reply With Quote
  #2  
Old 25-08-2008
Member
 
Join Date: Oct 2005
Posts: 2,389
That is why people use form classes / functions/ whatever

Then you can do stuff like
Code:
$form->set('checkbox','mycheckbox','myvalue',ISSET);

if($form->validate()){

// form validates

} else {

$form->show();

}
Otherwise you have to cede like
Code:
if(!empty($_POST['myform'])){

array_push($aErrors,'mycheckbox');

}

// etc


if(sizeof($aErors)){

inlcude('form.php');

} else {

// form validates

}


form.php

<input type="checkbox" name="mycheckbox">
<?php if(isset($aErrors['mycheckbox'])){

echo 'Whoops';

}?>
etc
Reply With Quote
  #3  
Old 25-08-2008
Member
 
Join Date: Feb 2008
Posts: 1,848
Quote:
Originally Posted by Reegan View Post
That is why people use form classes / functions/ whatever

Then you can do stuff like
[code]$form->set('checkbox','mycheckbox','myvalue',ISSET);
So what's your favorite form class?
Reply With Quote
  #4  
Old 25-08-2008
Member
 
Join Date: Oct 2005
Posts: 2,389
Classes are irrelevant to this situation. In fact classes should never be used with PHP. They offer very few advantages and make code totally obscure. That is not welcome and should be avoided at all costs in any validation action.

If you need to use classes you should not be using a script language anyway.
Reply With Quote
  #5  
Old 25-08-2008
Member
 
Join Date: Feb 2008
Posts: 1,848
Quote:
Originally Posted by Reegan View Post
Classes are irrelevant to this situation. In fact classes should never be used with PHP. They offer very few advantages and make code totally obscure. That is not welcome and should be avoided at all costs in any validation action.

If you need to use classes you should not be using a script language anyway.
I dont agree. Classes are actually great. They make code much more reliable and maintainable.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags:



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to reload form"
Thread Thread Starter Forum Replies Last Post
Google Chrome is opening in basic HTML form instead of the Standard form Beatrix Technology & Internet 5 25-05-2011 10:21 PM
how to get items in a form to auto-resize with the form using visual basic deansmylie93 Software Development 2 02-05-2011 07:06 AM
How to Auto Populate fields from sub form to form? mich43 Windows Software 6 09-11-2010 11:29 PM
Procedure in VB to create form inside another form Jalabala Software Development 3 16-11-2009 02:14 PM
Problem reloading MDI child form in main form. AFFAN Software Development 3 30-01-2009 09:05 PM


All times are GMT +5.5. The time now is 05:07 PM.