Barter Zone
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsGeneralBarter Zone

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old May 26th, 2007, 08:34 AM
PoetAlley PoetAlley is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: May 2007
Posts: 3 PoetAlley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 45 m 19 sec
Reputation Power: 0
Someone Needed to Adjust PHP Form Script

I need someone to adjust a script for me so that the details the form grabs is submitted to it's database table. I am prepared to send links to the 5 albums that a friend of mine and myself have recorded to the person who completes the form so that all the essential details are submitted to the table. We will also give you written permission to pass these recordings on to anyone you care to, including sharing on programs like LimeWire.
Below is the error messages I receive when I do a test submission:

Please enter a page quantity between 1 and 99!

Please enter your titles for each page!

Please enter a colour for your header section!

Please enter a colour for your centre section!

You request could not be processed due to a system error. We apologize for any inconvenience.

and this is the code for the script and the form,
Code:
<?php
ob_start();
session_start();
// Include the configuration file for error management and such.
require_once ('includes/config.inc.php');
 if (isset($_POST['Send'])) {
 // Handle the form.
require_once ('includes/mysql_connect.php');
// Connect to the database.	
// Check for an email address.
	if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*@[a-z0-9\.\-]+\.[a-z]{2,4}$', stripslashes(trim($_POST['email'])))) {		$e = escape_data($_POST['email']);	} else {		$e = FALSE;
	echo '<p>Please enter a valid email address!</p>';	}
	// Check for pages quantity.	if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*@[a-z0-9\.\-]+\.[a-z]{2,4}$', stripslashes(trim($_POST['pages'])))) {
	$p = escape_data($_POST['pages']);	} else {		$p = FALSE;
	echo '<p>Please enter a page quantity between 1 and 99!</p>';
	}
	// Check for site design.
	if (eregi ('^[[:alnum:]\.\' \-]{2,30}$', stripslashes(trim($_POST['design'])))) {	
	$d = escape_data($_POST['design']);	} else {		$d = FALSE;
	echo '<p>Please select the design you require!</p>';	}
	// Check for page titles.
	if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*@[a-z0-9\.\-]+\.[a-z]{2,4}$', stripslashes(trim($_POST['titles'])))) {		$t = escape_data($_POST['titles']);
	} else {
	$t = FALSE;
	echo '<p>Please enter your titles for each page!</p>';	}
	// Check for a header colour.
	if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*@[a-z0-9\.\-]+\.[a-z]{2,4}$', stripslashes(trim($_POST['header'])))) {		$h = escape_data($_POST['header']);	} else {		$h = FALSE;
	echo '<p>Please enter a colour for your header section!</p>';
	}
	// Check for a left column colour.
	if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*@[a-z0-9\.\-]+\.[a-z]{2,4}$', stripslashes(trim($_POST['left'])))) {		$l = escape_data($_POST['left']);	} else {		$l = '<i>No left column required!</i>';	}		// Check for a centre section colour.
	if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*@[a-z0-9\.\-]+\.[a-z]{2,4}$', stripslashes(trim($_POST['centre'])))) {		$c = escape_data($_POST['centre']);	} else {		$c = FALSE;
	echo '<p>Please enter a colour for your centre section!</p>';
	}
	// Check for a right column colour.
	if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*@[a-z0-9\.\-]+\.[a-z]{2,4}$', stripslashes(trim($_POST['right'])))) {		$r = escape_data($_POST['right']);
	} else {
	$r = '<i>No right column required!</i>';
	}
	// Check for a footer colour.	if (eregi ('^[[:alnum:]][a-z0-9_\.\-]*@[a-z0-9\.\-]+\.[a-z]{2,4}$', stripslashes(trim($_POST['footer'])))) {
	$f = escape_data($_POST['footer']);
	} else {
	$f = '<i>No footer section required!</i>';
	}
	// Check for extra auxillary pages.
	if (eregi ('^[[:alpha:]\.\' \-]{2,15}$', stripslashes(trim($_POST['extra'])))) {
	$x = escape_data($_POST['extra']);
	} else {
	$x = '<i>Extra pages not essential!</i>';
// Determine the Price per page.
	if ($p < 4) {
	$cost = "£30";
	} elseif (
4 <= $p && $p < 8) {
	$cost = "£25";
	} elseif ($p >= 8) {
	$cost = "£22.50";	
}
	$total = $p * $cost;
	if ($e && $p && $d && $t && $h && $l && $c && $r &&  $f && $x && $cost && $total) {
	// Add the request to the database.
	$query = "INSERT INTO site_request (email, pages, design, titles, header, left, centre, right, footer, extra, cost, total, request_date) VALUES ('$e', '$p', '$d', '$t', '$h', '$l', '$c', '$r', '$f', '$x', '$cost', '$total', 'NOW()' )";
	$result = mysql_query ($query) or trigger_error("Query: $query\n<br />MySQL Error: " . mysql_error());		if (!$didit){
	echo("Your request has not been received, please try contacting us later");
	} else {
	echo("Thank you for your web site creation request, we will get back to you about further details at $e.");
	}
	$didit = mail($e, $subject, $body, "alleycat@home-groan.com");
	$subject = "Site Creation Request";
	$body = "Thank you for requesting us to build a site for you.  Although you have told us that you would like us to create $p pages at a cost of '£'.$cost per page, there are still some details we would require from you which we will request in an forthcoming email.  The pages will be designed in the $d style, with each page using the titles, $t.  The colour scheme for the site will be $h for the header, $l for the left column, $c for the centre, $r for the right column, and $f for the footer.  The site will also contain $x supplementary page(s).";
	$subject = "Site Creation Request";
	$body = "A request for a site to be created has been received.  The site consists of $p pages, in the $d style, using the following colour scheme: header, $h, left column, $l, centre, $c, right column, $r and footer, $f.  $x supplementary page(s) are also required.";
	if(!mail("alleycat@home-groan.com", $subject, $body, "accident@accidentrecordings.com")){		print 'Your message has not been received, please try contacting us later.';
	}
	// Complete the page.	echo ("Thank you for your request to create a web site, an email has been sent to $e with the details you have selected for it, and further developements.");
	include ("includes/foot.html");
	} else { // If it did not run OK.
	echo '<p>You request could not be processed due to a system error. We apologize for any inconvenience.</p>'; 	}
	mysql_close(); // Close the database connection.
}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "(URL address blocked: See forum rules)">
<html xmlns="(URL address blocked: See forum rules)" xml:lang="en"> <head>
<title>Site Creation Request</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="keywords" content="Home-Groan, Music downloads, MP3 downloads, MP3, Music, MP3 Music downloads, Accident downloads, Accident Music downloads, Accident MP3 downloads, Accident MP3 Music downloads, HG 001, Accident Albums, Home of Accident Recordings, Alley Cat, Brill O'Padd, Alley Cat and Brill O'Padd, Alley Cat and Brill O'Padd Song Writers, Accident Fated to Happen album, Child of War, Dearest Helen, Indian Lament, Sleepless Nights, Graveyard Sign, Help Me Nurze, Harmony in B E D, Glencoe, Remembering, Lambs to the Slaughter, Girl When I Loved You, Pretty Princess, See The City, Symphony of Romance, Dancing Between Silk Sheets, Is This Our Future" />
<link href="error.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div class="header">
<a href="(URL address blocked: See forum rules)"><img src="images/logo2.JPG" alt="Accident Recordings" /></a>
<p>Site Creation<br />Request Form</p>
</div>
<div class="leftcolumn">
<table>
<tr><td><a href="index.php"><img src="images/logo_button.JPG" alt="Home-Groan Home" />Home</a></td></tr>
<tr><td><a href="albums.php"><img src="images/logo2_button.JPG" alt="Accident Albums" />Accident Albums</a></td></tr>
<tr><td><a href="screensavers.php"><img src="images/screen-saver_button.JPG" alt="Home-Groan Screen Savers" />Screen Savers </a></td></tr><tr><td><a href="websites.php"><img src="images/website_button.JPG" alt="Home-Groan Web Sites"/>Web Sites</a></td></tr>
<tr><td><a href="(URL address blocked: See forum rules)">Contact Us</a></td></tr>
</table>
<p><a href="(URL address blocked: See forum rules)=referer"><img src="(URL address blocked: See forum rules)" alt="Valid XHTML 1.0 Strict" height="31" width="88"></img></a><br /><br />
<a href="(URL address blocked: See forum rules)"> <img style="border:0;width:88px;height:31px" src="(URL address blocked: See forum rules)" alt="Valid CSS!"></img> </a>
</p>
</div>
<div class="centre">
<form action="site_request.php" method="post">
<fieldset>
<p><b>Email Address:</b> <input type="text" name="email" size="40" maxlength="40" value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>" /> </p>
<p>How many HTML pages would you require?<br /><b>Number of Pages:</b> <input type="text" name="pages" size="3" maxlength="3" value="<?php if (isset($_POST['pages'])) echo $_POST['pages']; ?>" /> </p><p>Please enter the style of page you require.<br /><b>Design Style:</b> <input type="text" name="design" size="15" maxlength="30" /></p>
<p>Please enter your page titles here, separated by commas.<br /><b>Page Titles:</b> <textarea name="titles" cols="60" rows="5"></textarea></p> <p>Please select the colour you require for each section of your site, you can choose either the colour name or hexadecimal number.<br /></p>
<p><b>Header:</b> <input type="text" name="header" size="15" maxlength="15" /></p>
<p><b>Left Column:</b> <input type="text" name="left" size="15" maxlength="15" /></p>
<p><b>Centre:</b> <input type="text" name="centre" size="15" maxlength="15" /></p>
<p><b>Right Column:</b> <input type="text" name="right" size="15" maxlength="15" /></p>
<p><b>Footer:</b> <input type="text" name="footer" size="15" maxlength="15" /></p>
<p>If you require a Search or Contact Page, please enter either the page name, or <strong>both </strong>if both are required.<br /> <b>Extra Pages:</b> <input type="text" name="extra" size="15" maxlength="15" /></p>
</fieldset>
<p><input type="submit" name="Send" value="Place Request" />
<input type="reset" name="Submit2" value="Amend Request" /></p>
</form>
<table>
<tr><td><img src="images/page1.JPG" alt="Surround Style" /></td>
<td><img src="images/page2.JPG" alt="Alternative Surround Style" /></td>
<td><img src="images/page3.JPG" alt="3 Rows Style" /></td>
<td><img src="images/page4.JPG" alt="Triangle Style" /></td>
<td><img src="images/page5.JPG" alt="Alternative Triangle Style" /></td></tr>
</table>
</div>
<div class="footer"><h5>© (URL address blocked: See forum rules) 2007, designed and built by <a href="(URL address blocked: See forum rules)">(URL address blocked: See forum rules)</a></h5>
</div>
</body>
</html>
Code:
<?php
ob_end_flush();
?>

Reply With Quote
Reply

Viewing: Codewalkers ForumsGeneralBarter Zone > Someone Needed to Adjust PHP Form Script


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway