Upload Form and Submit - Paypal

17 posts by 2 authors in: Forums > CMS Builder
Last Post: September 12, 2014   (RSS)

Like I said before, you have to submit the form on the initial page - testdir.php - to the preview.php page. You can't submit testdir to itself, obviously it's going to go through all the form code you've added at the start.

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Are you talking about the form action on the testdir.php page? I have that set to go to the preview.php page.

If it's still submitting data, then either something's gone wrong on the testdir page, or you're not checking for the trigger on the preview page and the form is being processed before being displayed.

On the preview page, you need to make sure that the $_REQUEST data from testdir is coming through, but not being saved just yet, only displayed on the page. That's where you check to see if previewupdate is set and prevent anything from being processed if it's not.

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Could it be that I have my php form code on the testdir.php page?

 ########################################################################################
  ##   Form Code
  
  $schema = loadSchema('dir_listings');
  
  // save?
  $errorsAndAlerts = '';
  
 
  
  if (@$_REQUEST['save']) {
   
   
 
    
    if ($errorsAndAlerts) {
    
   if (!@$_REQUEST['title'])             { $errorsAndAlerts .= "You must enter your listing name!<br/>\n"; }
    if (!@$_REQUEST['state'])            { $errorsAndAlerts .= "You must enter your state!<br/>\n"; }
    if (!@$_REQUEST['city'])             { $errorsAndAlerts .= "You must enter your city!<br/>\n"; }
    if (!@$_REQUEST['zipcode'])          { $errorsAndAlerts .= "You must enter your zip!<br/>\n"; }
    if (!@$_REQUEST['address'])          { $errorsAndAlerts .= "You must enter your address!<br/>\n"; }
    if (!@$_REQUEST['summary'])          { $errorsAndAlerts .= "You must choose a description!<br/>\n"; }
   if (!@$_REQUEST['category'])          { $errorsAndAlerts .= "You must select a category!<br/>\n"; }
  }
    
   
 // save!
    if (!$errorsAndAlerts) {
mysqlStrictMode(false); // disable Mysql strict errors for when a field isn't defined below (can be caused when fields are added later)
      require_once("../../cmsAdmin/lib/user_functions.php");
      $record = array_slice_keys($_REQUEST, explode(', ', 'category, title, address, city, state, zipcode, summary'));
      
      $record = array_merge($record, array(
        'hidden'           => 1,
       'createdDate'      => mysql_datetime(),
        'createdByUserNum' => intval( @$CURRENT_USER['num'] ),
        'updatedDate'      => mysql_datetime(),
        'updatedByUserNum' => intval( @$CURRENT_USER['num'] ),
        'publishDate'      => mysql_datetime(),
 'date'             => mysql_datetime(),
        'reg_listing'      => 1,
 'url_link'        => 0,
        'neverRemove'      => 1,
      ));
      
    
}
  }
    
  $_REQUEST['preSaveTempId'] = coalesce(@$_REQUEST['preSaveTempId'], uniqid());
  
?>

Could this be causing it?

Claire,

I actually figured it out. I had an hidden field on my testdir,php page so I got it all working. My only other question is it still possible to validate the data for required fields on the first page (testdir.php) before it goes to the preview page?

If you're submitting directly to the preview page, then no, but you can still validate on the preview page before displaying it. It's not ideal, but it will work.

--------------------

Claire Ryan
interactivetools.com

Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/