Smal test form fails

Issues related to forms.
dbail
Posts: 8
Joined: Tue Dec 12, 2017 8:30 pm

Smal test form fails

Post by dbail » Tue Dec 12, 2017 9:41 pm

Trying to begin with something simple, I followed the instructions for a PHP page and creating a form on an HTML page. When I select the submit I see this error.


Parse error: syntax error, unexpected 'if' (T_IF) in /home/content/90/11189690/html/feedback.php on line 8

I pasted the PHP code in directly from your instructions on the web site. I have a field called email.

User avatar
Pablo
Site Admin
Posts: 2906
Joined: Mon Feb 13, 2006 7:00 am
Location: Europe
Contact:

Re: Smal test form fails

Post by Pablo » Wed Dec 13, 2017 8:39 am

This indicates an error in the code.
Why are you pasting PHP code? There is no need to write any code yourself for basic forms, you can use the built-in form processor.

Related FAQ:
http://www.quickandeasywebbuilder.com/f ... 10&t=32967

dbail
Posts: 8
Joined: Tue Dec 12, 2017 8:30 pm

Re: Smal test form fails

Post by dbail » Thu Dec 14, 2017 5:06 am

I created a new page with nothing added. Used the most simple example in the options. Set the option to use Automatic PHP... Set the email to my email. Set the success to one of my pages. Set the failure to one of my pages. Left it as a HTML page. Published the page. Checked the host has enabled PHP 5.6.

The published page shows several lines of PHP code when viewed with Firefox or Safari or Chrome. The fields on the form are about 1/3 as high as the design layout and of course selecting the Submit button fails.

User avatar
Pablo
Site Admin
Posts: 2906
Joined: Mon Feb 13, 2006 7:00 am
Location: Europe
Contact:

Re: Smal test form fails

Post by Pablo » Thu Dec 14, 2017 7:17 am

Did you set the file extension of the page to PHP?
What is the URL?

Related FAQ (please read carefully);
http://www.quickandeasywebbuilder.com/f ... 10&t=32967

dbail
Posts: 8
Joined: Tue Dec 12, 2017 8:30 pm

Re: Smal test form fails

Post by dbail » Thu Dec 14, 2017 7:39 pm

I carefully read the instructions twice and followed them while having your program open to track step by step. If the page the form is on is set to html the php text appears at the top and nothing happens. If the page is set to PHP the text still appears and clicking the submit button shows a 404 error. The url in the browser bar shows it is looking for

/<?php echo basename(__FILE__); ?>

and does not find it. Both success and failure pages are entered.

betwixt
Posts: 30
Joined: Mon Nov 25, 2013 3:49 pm

Re: Smal test form fails

Post by betwixt » Thu Dec 14, 2017 11:47 pm

If you have already published a page with HTML don't forget to delete it from the server. Most, if not all, browsers when they see two pages of the same name will load the HTML one in preference to the PHP one. That means any changes you make to the PHP page will be uploaded correctly to the server but the old HTML one will still be shown in the browser and you will not see any edits or setting changes since it was published.

Brian.

User avatar
Pablo
Site Admin
Posts: 2906
Joined: Mon Feb 13, 2006 7:00 am
Location: Europe
Contact:

Re: Smal test form fails

Post by Pablo » Fri Dec 15, 2017 7:16 am

Does your webhost support PHP?

If the PHP code is displayed then it either means that the page extension is not PHP or the server does not support PHP.

dbail
Posts: 8
Joined: Tue Dec 12, 2017 8:30 pm

Re: Smal test form fails

Post by dbail » Sat Dec 16, 2017 4:45 am

Ok, then it is something else on my Mac Pro. I followed the steps plus.

Deleted quickandeasywebbuilder
Downloaded and installed new version

Deleted entire web site.
Removed any testing pages from the web site created in web builder.
Checked each page to show html file extension
Republished the web site and confirmed all pages and menus are working.

Added new page (page1)
Set page extension to php
Created form wizard object
Selected to create from template
Entered my email address
Entered success page
Entered failure page
Finished Form Wizard
Published all items

Nothing additional done or settings changed.

Opened Safari and accessed page.

Still shows code and not form. Does not show PHP but shows all of HTML code beginning with.

body
{
background-color: #FFFFFF;
color: #000000;
font-family: Arial;
font-weight: normal;
font-size: 13px;
line-height: 1.1875;
margin: 0;
padding: 0;
}
#wb_Form1
{
background-color: #F4F4F4;
background-image: none;
border: 0px #000000 solid;

User avatar
Pablo
Site Admin
Posts: 2906
Joined: Mon Feb 13, 2006 7:00 am
Location: Europe
Contact:

Re: Smal test form fails

Post by Pablo » Sat Dec 16, 2017 7:59 am

Did you publish the page to a web server with PHP support?
Are you sure?
What is the URL?

Note that this has nothing to do with the software, so reinstalling it will not make any difference.

dbail
Posts: 8
Joined: Tue Dec 12, 2017 8:30 pm

Re: Smal test form fails

Post by dbail » Sat Dec 16, 2017 8:35 pm

Here is the version information for PHP hosted by GoDaddy

The page is animaloutreach.net/page1 and it has only the smallest contact form from the templates on the page and the page is designated php


It appears to be displaying a css file which is created in spite of the page extension set to php. Is that correct?


PHP Version 5.6.27
System Linux p3nlhg1173.shr.prod.phx3.secureserver.net 2.6.32-673.26.1.lve1.4.30.el6.nfsfixes.x86_64 #1 SMP Wed Jul 26 10:28:40 MST 2017 x86_64
Build Date Apr 26 2017 15:49:56
Configure Command './configure' '--with-libdir=lib' '--enable-opcache' '--enable-fastcgi' '--prefix=/usr/local/php5_6' '--with-config-file-path=/web/conf' '--enable-posix' '--enable-bcmath' '--enable-calendar' '--with-curl=/usr/bin/curl' '--with-gdbm' '--enable-exif' '--enable-ftp' '--with-gd' '--with-freetype-dir=/usr' '--with-jpeg-dir=/usr' '--with-png-dir=/usr/bin/libpng-config' '--enable-gd-native-ttf' '--with-gettext' '--with-mcrypt=/usr/bin/libmcrypt-config' '--with-mhash' '--with-pdo' '--with-pdo-mysql=/usr' '--with-mysql=/usr' '--with-mysqli=/usr/bin/mysql_config' '--with-openssl' '--with-pspell' '--enable-soap' '--enable-wddx' '--with-xsl' '--with-zlib' '--enable-mbstring' '--enable-zip' '--with-xmlrpc' '--sysconfdir=/web/httpd24/conf' '--with-imagick' '--with-config-file-scan-dir=/etc/php.d' '--enable-memcache' '--enable-cli'
Server API CGI/FastCGI
Virtual Directory Support disabled
Configuration File (php.ini) Path /web/conf
Loaded Configuration File /web/conf/php56.ini
Scan this dir for additional .ini files /etc/php.d
Additional .ini files parsed (none)
PHP API 20131106
PHP Extension 20131226
Zend Extension 220131226
Zend Extension Build API220131226,NTS
PHP Extension Build API20131226,NTS
Debug Build no
Thread Safety disabled
Zend Signal Handling disabled
Zend Memory Manager enabled
Zend Multibyte Support provided by mbstring
IPv6 Support enabled
DTrace Support disabled
Registered PHP Streams https, ftps, compress.zlib, php, file, glob, data, http, ftp, phar, zip
Registered Stream Socket Transports tcp, udp, unix, udg, ssl, sslv3, sslv2, tls, tlsv1.0, tlsv1.1, tlsv1.2
Registered Stream Filters zlib.*, convert.iconv.*, mcrypt.*, mdecrypt.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk

User avatar
Pablo
Site Admin
Posts: 2906
Joined: Mon Feb 13, 2006 7:00 am
Location: Europe
Contact:

Re: Smal test form fails

Post by Pablo » Sat Dec 16, 2017 9:41 pm


dbail
Posts: 8
Joined: Tue Dec 12, 2017 8:30 pm

Re: Smal test form fails

Post by dbail » Sat Dec 16, 2017 9:56 pm

I apologize, I had forgotten I gave you the url. I was continuing to test using other forms. The page extension and redirect pages have been corrected. I will leave this page as it is and create another page for other testing. I deleted this page/s html,css,php from the host and then republished the page. Again I am sorry for forgetting I had given you the page.

dbail
Posts: 8
Joined: Tue Dec 12, 2017 8:30 pm

Re: Smal test form fails

Post by dbail » Sat Dec 16, 2017 10:02 pm

To save you a trip to the page, below is the text I copied from page1.php generated by quickneasy...

<?php
function ValidateEmail($email)
{
$pattern = '/^([0-9a-z]([-.\w]*[0-9a-z])*@(([0-9a-z])+([-\w]*[0-9a-z])*\.)+[a-z]{2,6})$/i';
return preg_match($pattern, $email);
}
if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['formid'] == 'a_new_form')
{
$mailto = 'dbail22@comcast.net';
$mailfrom = isset($_POST['email']) ? $_POST['email'] : $mailto;
$subject = 'Contact Information';
$message = 'Values submitted from web site form:';
$success_url = './page1.php';
$error_url = './page1.php';
$error = '';
$eol = "\n";
$boundary = md5(uniqid(time()));
$header = 'From: '.$mailfrom.$eol;
$header .= 'Reply-To: '.$mailfrom.$eol;
$header .= 'MIME-Version: 1.0'.$eol;
$header .= 'Content-Type: multipart/mixed; boundary="'.$boundary.'"'.$eol;
$header .= 'X-Mailer: PHP v'.phpversion().$eol;
if (!ValidateEmail($mailfrom))
{
$error .= "The specified email address is invalid!\n<br>";
}
if (!empty($error))
{
$errorcode = file_get_contents($error_url);
$replace = "##error##";
$errorcode = str_replace($replace, $error, $errorcode);
echo $errorcode;
exit;
}
$internalfields = array ("submit", "reset", "send", "filesize", "formid", "captcha_code", "recaptcha_challenge_field", "recaptcha_response_field", "g-recaptcha-response");
$message .= $eol;
$message .= "IP Address : ";
$message .= $_SERVER['REMOTE_ADDR'];
$message .= $eol;
$logdata = '';
foreach ($_POST as $key => $value)
{
if (!in_array(strtolower($key), $internalfields))
{
if (!is_array($value))
{
$message .= ucwords(str_replace("_", " ", $key)) . " : " . $value . $eol;
}
else
{
$message .= ucwords(str_replace("_", " ", $key)) . " : " . implode(",", $value) . $eol;
}
}
}
$body = 'This is a multi-part message in MIME format.'.$eol.$eol;
$body .= '--'.$boundary.$eol;
$body .= 'Content-Type: text/plain; charset=ISO-8859-1'.$eol;
$body .= 'Content-Transfer-Encoding: 8bit'.$eol;
$body .= $eol.stripslashes($message).$eol;
if (!empty($_FILES))
{
foreach ($_FILES as $key => $value)
{
if ($_FILES[$key]['error'] == 0)
{
$body .= '--'.$boundary.$eol;
$body .= 'Content-Type: '.$_FILES[$key]['type'].'; name='.$_FILES[$key]['name'].$eol;
$body .= 'Content-Transfer-Encoding: base64'.$eol;
$body .= 'Content-Disposition: attachment; filename='.$_FILES[$key]['name'].$eol;
$body .= $eol.chunk_split(base64_encode(file_get_contents($_FILES[$key]['tmp_name']))).$eol;
}
}
}
$body .= '--'.$boundary.'--'.$eol;
if ($mailto != '')
{
mail($mailto, $subject, $body, $header);
}
header('Location: '.$success_url);
exit;
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>page1</title>
<meta name="generator" content="Quick 'n Easy Web Builder - http://www.quickandeasywebbuilder.com">
<link href="AOSite.css" rel="stylesheet" type="text/css">
<link href="page1.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="wb_A_New_Form" style="position:absolute;left:205px;top:71px;width:467px;height:376px;z-index:5;">
<form name="contact" method="post" action="<?php echo basename(__FILE__); ?>" enctype="multipart/form-data" id="A_New_Form">
<input type="hidden" name="formid" value="a_new_form">
<label for="Editbox1" id="Label1" style="position:absolute;left:10px;top:15px;width:40px;height:17px;line-height:17px;z-index:0;">Name:</label>
<input type="text" id="Editbox1" style="position:absolute;left:63px;top:15px;width:190px;height:15px;line-height:15px;z-index:1;" name="name" value="" spellcheck="false">
<label for="Editbox2" id="Label2" style="position:absolute;left:10px;top:45px;width:40px;height:17px;line-height:17px;z-index:2;">Email:</label>
<input type="text" id="Editbox2" style="position:absolute;left:63px;top:45px;width:190px;height:15px;line-height:15px;z-index:3;" name="email" value="" spellcheck="false">
<input type="submit" id="Button1" name="" value="Send" style="position:absolute;left:63px;top:75px;width:96px;height:25px;z-index:4;">
</form>
</div>
</body>
</html>

User avatar
Pablo
Site Admin
Posts: 2906
Joined: Mon Feb 13, 2006 7:00 am
Location: Europe
Contact:

Re: Smal test form fails

Post by Pablo » Sun Dec 17, 2017 7:22 am

The form seems to be working now.
Also as you can see, the generate code is correct.

Note that normally the success/error page are a different page.

dbail
Posts: 8
Joined: Tue Dec 12, 2017 8:30 pm

Re: Smal test form fails

Post by dbail » Sun Dec 17, 2017 6:21 pm

So I am using a Mac Pro with OSX High Sierra. Do you know of any changes to the webkit or anything else that would continue to show only text on my computer instead of the form? I still only see this text (beginning text only) in Firefox, Safari and Chrome when accessing the page.

body
{
background-color: #FFFFFF;
color: #000000;
font-family: Arial;
font-weight: normal;
font-size: 13px;
line-height: 1.1875;
margin: 0;
padding: 0;
}
#wb_A_New_Form
{
background-color: #F4F4F4;
background-image: none;
border: 0px #000000 solid;

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests