PHP Cuts bottom content off - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Webmaster Tech > Programming > PHP Development

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 09-01-2010, 06:13 PM   #1 (permalink)
Junior Member
 
Join Date: Sep 2010
Location: San Antonio,TX USA
Posts: 2
Unhappy PHP Cuts bottom content off

hello

i created a php file to handle my html form

but when the user doesnt fill out a text field in the form

they get (error message your some of the fields have not been completed
please go back in fill)

if you fill them out it will say thank you etc......................

the problem is if they forget to fill a text field on the form, on the php it cuts

off all the content under it , BUT if they fill out the form correctly it takes them to the same php page and it doesnt cut off the content

how can i fix this problem so the error page will display exactly the same as if it did not contain any errors.
modifiedarts is offline   Reply With Quote
Sponsored Links
Old 09-08-2010, 07:02 AM   #2 (permalink)
Junior Member
 
Join Date: Sep 2010
Location: Leeds, UK
Posts: 4
Default Re: PHP Cuts bottom content off

What PHP cade are you using to parse the form? I guess you're posting the form to a process.php sort of script?

What you need to do in here is test each input is valid and acceptable, and store an error sting if it is not. Then echo the Error string after it's finished parsing, and send the header back to the form page.

This way you'll capture your errors.

If you want to, post your PHP in here and I'll take a look
cubicaaron is offline   Reply With Quote
Old 09-08-2010, 03:58 PM   #3 (permalink)
Junior Member
 
Join Date: Sep 2010
Location: San Antonio,TX USA
Posts: 2
Default Re: PHP Cuts bottom content off

do you know how to make a dropdown menu required

i am confused on what you said

i sort of fixed it i

added

include_once("gobackbtn.html");
include_once("bottom_site_map_error.html");
so it would cut the content off

im sure i just did a shortcut but not profesionally take a look

<?php
if(isset($_POST['email'])) {

// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "name@gmail.com";
$email_subject = "SUBJECT.";


function died($error) { // your error code can go here
echo "<br />";
echo "<div align='center'><h1>We are very sorry, but there were error(s)<br /> found with your form submission.</h1></div><br /><br />";
echo "<p style='color:green'><h2> These errors appear below: </h2></p> <br />";
echo $error."<br /><br />";
include_once("gobackbtn.html");
include_once("bottom_site_map_error.html");
die();
}

// validation expected data exists
if(!isset($_POST['name']) ||
!isset($_POST['email']) ||
!isset($_POST['telephone']) ||
!isset($_POST['country']) ||
!isset($_POST['address']) ||
!isset($_POST['drop_down'])) {
died('We are sorry, but there appears to be errors with the form your submitted.');
}

$name = $_POST['name']; // required
$company = $_POST['company'];
$address = $_POST['address']; // required
$addresss = $_POST['addresss'];
$country = $_POST['country']; // required
$telephone = $_POST['telephone']; // required
$mobile = $_POST['mobile'];
$email_from = $_POST['email']; // required
$dropdown = $_POST['drop_down']; //required
$comments = $_POST['comments']; // required
$option = $_POST['radio'];
$model = $_POST['model'];
$modeltype = $_POST['modeltype'];
$location = $_POST['location'];
$list = $_POST['list'];
$levels = $_POST['levels'];
$notes = $_POST['notes'];

foreach($_POST['check'] as $value) {
$check_msg .= "Optional Equip: $value\n";
}

$error_message = "";
$email_exp = "^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$";
if(!eregi($email_exp,$email_from)) {
$error_message .= 'The Email Address you entered does not appear to be valid.<br />';
}
$string_exp = "^[a-z .'-]+$";
if(!eregi($string_exp,$name)) {
$error_message .= 'The Name you entered does not appear to be valid.<br />';
}
if(strlen($address) < 2) {
$error_message .= 'The Address you entered does not appear to be valid.<br />';
}
$string_exp = "^[a-z .'-]+$";
if(!eregi($string_exp,$country)) {
$error_message .= 'The Country you entered does not appear to be valid.<br />';
}
$string_exp = "^[0-9 .-]+$";
if(!eregi($string_exp,$telephone)) {
$error_message .= 'The Phone Number you entered does not appear to be valid.<br />';
}
if(strlen($error_message) > 0) {
died($error_message);
}
modifiedarts is offline   Reply With Quote
Old 09-13-2010, 07:22 AM   #4 (permalink)
Regular User
 
Join Date: Sep 2010
Posts: 30
Default Re: PHP Cuts bottom content off

Why this is there and also it's not closed with }

PHP Code:
if(isset($_POST['email'])) { 
PradeepKr is offline   Reply With Quote
Reply

Tags
help me , html , php

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 08:00 PM.


Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
Webmaster Forums
Web Hosting | Chicago Web Hosting | Web Hosting