pHp form
Moderator: General Moderators
pHp form
I have a website that requires a customer to upload a photo, enter some info and then head to Paypal.
Someone built a form for me and though it's pretty looking, consumer friendly is another problem. Unfortunately I know diddley about pHp, which is why I paid the guy in the first place. Unfortunately, I've been blown off for the last two weeks and thought maybe someone could help me.
If you go to http://www.weddingsandchildrensgifts.info/submit.php you will see the form. Go ahead and play with it to see what I mean. Once you get through step 3 it gives you a"view cart" from paypal and not an add to cart. You have to click "ready to pay" to add it. A real pain and makes no sense.
Anywho, I'm out a lot of money and I feel this form is so un-userfriendly, I'm afraid it will scare customers away. ANy suggestions would be very welcome. Also, I can provide any code you may need to see what's going on.
THanks a million for any help you can give.
Cortney
Someone built a form for me and though it's pretty looking, consumer friendly is another problem. Unfortunately I know diddley about pHp, which is why I paid the guy in the first place. Unfortunately, I've been blown off for the last two weeks and thought maybe someone could help me.
If you go to http://www.weddingsandchildrensgifts.info/submit.php you will see the form. Go ahead and play with it to see what I mean. Once you get through step 3 it gives you a"view cart" from paypal and not an add to cart. You have to click "ready to pay" to add it. A real pain and makes no sense.
Anywho, I'm out a lot of money and I feel this form is so un-userfriendly, I'm afraid it will scare customers away. ANy suggestions would be very welcome. Also, I can provide any code you may need to see what's going on.
THanks a million for any help you can give.
Cortney
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Go ahead and post it here... please useSunmune wrote:yeah, bandwidth. Sigh, it's fixed, was fixed last night. Sorry about that.
The code is decently long and of course, since I don't know much about pHp, I'm not sure what to cut and paste.
I can post it, but it's long. Whatever is the best way, let me know and thanks.
Code: Select all
tags around it[/b]...
We can trim out what we don't need to see.Code: Select all
<?
$tow_names['tow_cherry'] = "Cherry";
$tow_names['tow_walnut'] = "Walnut";
$tow_names['tow_maple'] = "Maple";
define("STEP02","Step 2: Upload your photo");
define("STEP01","Step 1: Click on the type of Wood desired");
define("STEP03","Step 3: Enter your information");
define("STEP04","Final Step: After you confirm your selection,<br> a Paypal Cart will show with how to pay instruction.");
define('INST01','<font size="2">Please select the type of wood for your Pirolette by clicking the type of wood image below</font>');
define("INST02","Please browse and upload the photo. The photo must be in .jpg or .jpeg format.");
define("INST03","Enter your information & Confirm");
define("SUPPORT_CONTACT_FOR_CUSTOMER","-- Please notify us about this error:<br>---- Phone : 303-000-0000 or Email : support@weddingsandchildrensgifts.info<p>");
define("SUPPORT_CONTACT_FOR_CLIENT","-- Contact you database admin.<p> For additional support <a href='http://support.inspiresmart.com'>InspireSmart Support</a>");
define("ERROR001","Image Extension Unknown.<br>Only .jpg or .jpeg are allowed<br>Go back!");
if ($tow) $curr_tow="<img src=\"images/$tow.jpg\">";
$butt_sel_wood="<img src=\"images/select_wood.gif\">";
$butt_upl_imgs="<img src=\"images/upload_image.gif\">";
///////////////////////////////////////////////////////////////////////////////
// RESET SELECTION SECTION
// reset the type-of-wood selection
function reset_tow($tow) {
global $pay_now;
if ((!$pay_now) && ($tow)) { ?>
<form method="post">
<INPUT class="submit" type="submit" name="action" value="Undo Wood">
<INPUT type="hidden" name="reset_tow" value="1">
</form>
<?
}
}
// reset the image selection
function reset_img($img) {
global $pay_now;
if ((!$pay_now) && ($img)) { ?>
<form method="post">
<INPUT class="submit" type="submit" name="action" value="Undo Photo">
<INPUT type="hidden" name="reset_img" value="1">
</form>
<?
}
}
// reset the image selection
function reset_customer_info() {
global $reset_info, $pay_now;
if (!$pay_now) { ?>
<center>
<form method="post">
<INPUT class="submit" type="submit" name="action" value="Edit Information">
<INPUT type="hidden" name="reset_info" value="1">
</form>
</center>
<?
}
else { ?>
<center>
<form method="post">
<INPUT class="submit" type="submit" name="action" value="Continue Shopping">
<INPUT type="hidden" name="reset_all" value="1">
</form>
</center>
<?}
}
// reset the image selection
function pay_now() {
global $pay_now; ?>
<center>
<form method="post">
<INPUT class="submit" type="submit" name="action" value="Ready to Pay">
<INPUT type="hidden" name="pay_now" value="1">
</form>
</center>
<?
}
///////////////////////////////////////////////////////////////////////////////
//step3's i/p section
function show_name_email_phone_form() {
global $fname, $email, $phone, $paypal, $reset_info;
//validate fname.phone.email
if ((!$fname) or (!$email) or (!$phone)) $reset_info=1;
if ($reset_info) {
session_unregister('paypal'); $paypal=''; ?>
<form method="POST">
<table width="100%" align="bottom">
<tr><td colspan=2><?= INST03;?></td></tr>
<tr><td> Name:</td> <td><input type="text" name="fname" value="<?=$fname;?>"></td></tr>
<tr><td>Email:</td> <td><input type="text" name="email" value="<?=$email;?>"></td></tr>
<tr><td>Phone:</td> <td><input type="text" name="phone" value="<?=$phone;?>"></td></tr>
<tr><td> </td> <td><input class="submit" name="action" type="submit" value="Save Information"></td></tr>
</table>
</form>
<? }
else { $_SESSION['paypal'] = 1;?>
<table width="100%" valign="bottom">
<tr><td class="style28" colspan=2>Thank you for your order;</td></tr>
<tr><td class="style28">Name:</td> <td><?=$fname;?></td></tr>
<tr><td class="style28">Email:</td> <td><?=$email;?></td></tr>
<tr><td class="style28">Phone:</td> <td><?=$phone;?></td></tr>
<tr><td class="style28"> </td><td><? reset_customer_info($name); ?> </td></tr>
<tr><td class="style28"> </td><td><? pay_now(); ?> </td></tr>
</table>
<? }
}
//uploads image to seesion-id.jpg
function upload_image() { ?>
<form method="POST" enctype="multipart/form-data">
<table width="100%">
<input type="hidden" name="MAX_FILE_SIZE" value="2500000">
<tr><td colspan=2 class="style22"><?= STEP02;?></td></tr>
<tr><td><input type="file" name="imgfile"></td>
<td><input class="submit" type="Submit" name="action" value="Upload Image"></td></tr>
</table>
</form>
<? }
//display the selection on type of wood: individual form makes IE compatible
function show_select_tow() {
global $tow;?>
<table width="100%">
<tr><td class="style22" colspan=3><?= STEP01;?></td></tr>
<tr><td>
<form method="post">
<INPUT type="hidden" name="tow" value="tow_cherry">
<INPUT type="image" src="images/tow_cherry.jpg" name="towX" alt="tow" value="tow_cherry">
</form>
</td>
<td>
<form method="post">
<INPUT type="hidden" name="tow" value="tow_maple">
<INPUT type="image" src="images/tow_maple.jpg" name="towX" value="tow_maple">
</form>
</td>
<td>
<form method="post">
<INPUT type="hidden" name="tow" value="tow_walnut">
<INPUT type="image" src="images/tow_walnut.jpg" name="towX" value="tow_walnut">
</form>
</td>
</tr>
<tr><td align="center" class="style22">Cherry </td>
<td align="center" class="style22">Maple </td>
<td align="center" class="style22">Walnut </td>
</tr>
<!-- <tr><td align="center" class="style16">
<A HREF="">enlarge</A> </td>
<td align="center" class="style16">
<a href="javascript:;"
onClick="openPictureWindow_Fever('undefined','images/cortspirolette1.jpg','275','386','SUBMIT PROFILE- Turn Your Head','200','200')">
enlarge</A> </td>
<td align="center" class="style16"><A HREF="">enlarge</A> </td>
</tr> -->
</table>
<? }
//payment transaction
function show_final_txn_message() { ?>
<hr align="right" width="465">
<table width="100%">
<tr><td class="style22"><?= STEP04;?></td></tr>
<!-- <tr><td class="style28">Message about how transaction is handled - by store owner</td>
</tr> -->
</table>
<? }
//shows selected type of wood
function show_image_wood($tow) {
if ($tow)
echo "<img src=\"images/$tow.jpg\">";
else
print INST01;
}
//shows uploaded image as session-id.jpg
function show_image_face() {
global $img,$tow;
if ($img) echo "<img src=\"$img\" width=\"150\">";
else if (!$tow) echo "Pending<br>";
else echo INST02;;
}
//paypal addcart
function show_add_cart() {
global $img,$tow;
if (!$img or !$tow) echo "Pending<br>";
else { ?>
<table valign="top" width="100%">
<tr>
<td valign="top"><IMG SRC="images/paypal_pay.gif" WIDTH="210" HEIGHT="80" BORDER="0" ALT=""></td>
<td align="right" valign="top"> <? display_view_cart(); ?></td>
<td align="right" valign="top"> <? display_add_cart(); ?></td>
</tr></table>
<?
}
}
?>
<?
function display_add_cart() {
global $tow, $img, $tow_names, $pay_now;
//display_view_cart();
if ($pay_now) {
?>
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="on0" value="Pirolette" type="hidden">
<input name="os0" value="<?= $tow_names[$tow];?>" type="hidden">
<input src="images/x-click-but22.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" border="0" type="image">
<input name="add" value="1" type="hidden">
<input name="cmd" value="_cart" type="hidden">
<input name="business" value="contact@turnyourhead.com" type="hidden">
<input name="item_name" value="Pirolette" type="hidden">
<input name="amount" value="149.95" type="hidden">
<input name="page_style" value="Primary" type="hidden">
<input name="currency_code" value="USD" type="hidden">
</form>
<? }
}?>
<?
function display_view_cart() { ?>
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input name="cmd" value="_cart" type="hidden">
<input name="business" value="contact@turnyourhead.com" type="hidden">
<input src="images/view_cart_02.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" border="0" type="image">
<input name="display" value="1" type="hidden">
<input name="page_style" value="Primary" type="hidden">
</form>
<? } ?>
<?
function show_basic_instruction_wrong_way() { ?>
<table class="inst" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td colspan=2 class="style27">The Wrong Way</td> </tr>
<tr><td>
<a href="javascript:;"
onClick="openPictureWindow_Fever('undefined','images/Cortbadpiro.jpg','500','451','SUBMIT PROFILE- Turn Your Head','200','200')">
<img src="images/Cortbadpiro_small.jpg" width="128" height="111" border="1" id="tbb_3"></a>
</td>
<td>
<a href="javascript:;"
onClick="openPictureWindow_Fever('undefined','images/eriksbadpiro.jpg','500','426','SUBMIT PROFILE- Turn Your Head','200','200')">
<img src="images/eriksbadpiro_small.jpg" width="128" height="112" border="1" id="tbb_4"></a>
</td>
</tr>
</table>
<? } ?>
<?
function show_basic_instruction_directions() { ?>
<table border="0" cellpadding="5" cellspacing="5" width="150">
<tr>
<td class="style23" align="center">DIRECTIONS</td>
</tr>
<tr>
<td class="style23" align="center">PRINTABLE DIRECTIONS</td>
</tr>
</table>
<? } ?>
<?
function show_basic_instruction_right_way() { ?>
<table class="inst" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td colspan=2 class="style27">The Right Way</td></tr>
<tr> <td>
<a href="javascript:;"
onClick="openPictureWindow_Fever('undefined','images/flipryan.JPG','574','428','SUBMIT PROFILE- Turn Your Head','100','100')">
<img src="images/flipryan_small.jpg" width="125" height="98" border="1" id="tbb_1"></a>
</td>
<td><a href="javascript:;"
onClick="openPictureWindow_Fever('undefined','images/flipfran.JPG','550','440','SUBMIT PROFILE- Turn Your Head','100','100')">
<img src="images/flipfran_small.jpg" width="123" height="96" border="1" id="tbb_2"></a></td>
</tr>
</table><hr color="maroon" align="center" width="200">
<?
} ?>
<?
function show_basic_instruction() { ?>
<table class="inst" border=0>
<tr><td>
<font size=2>
The first step to getting your Pirolette made is taking your picture<br>
<b>-It's very important that you do it correctly-</b><br>
Please read the directions and use the sample pictures for guidance<br>
<p>
*CLICK ON THUMBNAILS TO ENLARGE*<br>
</font>
</td></tr></table><p>
<? } ?>
<?
function draw_menu() { //This function to die when flash links starts working ?>
<td height="30" width="125" align="center"><a href="/">Home</a></td>
<td width="125" align="center"><a href="about.php">About us</a></td>
<td width="126" align="center"><a href="whatisit.php">What is it</a></td>
<td width="126" align="center"><a href="submit.php">Submit </a></td>
<td width="125" align="center"><a href="faq.php">FAQ</a></td>
<td width="125" align="center"><a href="contact.php">Contact us</a></td>
<? }
function draw_logo() { ?>
<table width="766" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="b5af9f" bgcolor="eee5d6" borderwidth="thin">
<!--DWLayoutTable-->
<tr>
<td width="762" height="58"><div align="right"><span class="style14"><span class="style15">TURN</span> <span class="style16">YOUR HEAD</span></span> </div></td>
</tr>
</table>
<?php
}Code: Select all
<?php
///////////////////////////////////////////////////////////////////////////////
// InspireSmart: STANDARD
error_reporting(23);
// Include B-Logic and V-Logic :: non-intelligent style
include("includes/common.inc.php");
include("includes/display.inc.php");
?>
<?
///////////////////////////////////////////////////////////////////////////////
// PRE-PROCESSSING -
// Event based CONTROLLER/EVENT-TRACKER invocation
//if ($REQUEST_METHOD == "POST") {
// _INVOKE_CONTROLLER_POST();
//}
if ($REQUEST_METHOD == "POST") { //Inline basic post controller
// Step 00: action at reset request
_auto_reset();
// Step 01: Customers selection trapped in SESSION for DB insert
// Expand this technique to RAM processing
if ($tow) $_SESSION['tow'] = $tow;
if ($fname) $_SESSION['fname'] = $fname;
if ($email) $_SESSION['email'] = $email;
if ($phone) $_SESSION['phone'] = $phone;
if ($phone) $_SESSION['action'] = $action;
// Step 02: Customer selects thier Image and uploads
if ($imgfile) {
$uploaddir = "./orders";
$pext = getFileExtension($imgfile_name); $pext = strtolower($pext);
// check image file type, accept or reject
if (($pext != "jpg") && ($pext != "jpeg")) {
echo ERROR001;
unlink($imgfile);
exit();
}
//$oid = mysql query on next oid number. TODO
$final_filename = str_replace(" ", "_", $imgfile_name);
$newfile = "orders/$sid.jpg";
/*== do extra security check to prevent malicious abuse==*/
if (is_uploaded_file($imgfile)) {
if (!copy($imgfile,"$newfile")) {
print "Error Uploading File.";
exit();
}
}
unlink($imgfile);
// Step 01: Continued: Customers selection trapped in SEESION for DB insert
if ($newfile) $_SESSION['img'] = $newfile;
}
//Customer accepts or rejects in preview
}
$tow = $_SESSION['tow'];
$img = $_SESSION['img'];
$fname = $_SESSION['fname'];
//if ($paypal) { echo "TODO reminder"; print_r($_SESSION); echo " is recorded in database"; }
//if (($fname) and ($email) and ($phone) and ($tow) and ($img)) {
if ($pay_now)
$_SESSION['paypal'] = true;
else {
session_unregister('paypal');
$paypal='';
}
//}
// Check ready for DB insert, based on SESSION, Insert or Update;
//if (($fname) and ($email) and ($phone) and ($tow) and ($img)) {
if ($pay_now) $img = record_txn_in_table_turnurhead();
//}
?>
<? //show_header()?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>SUBMIT PROFILE- Turn Your Head</title>
<?php include("includes/styles.inc.css"); ?>
<script language="JavaScript" type="text/JavaScript">
<!--
function openPictureWindow_Fever(imageType,imageName,imageWidth,imageHeight,alt,posLeft,posTop) { // v4.01
newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",scrollbars=no,left="+posLeft+",top="+posTop);
newWindow.document.open();
newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">');
if (imageType == "swf"){
newWindow.document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
newWindow.document.write('<param name=movie value=\"'+imageName+'\"><param name=quality value=high>');
newWindow.document.write('<embed src=\"'+imageName+'\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
newWindow.document.write('</embed></object>'); }else{
newWindow.document.write('<img src=\"'+imageName+'\" width='+imageWidth+' height='+imageHeight+' alt=\"'+alt+'\">'); }
newWindow.document.write('</body></html>');
newWindow.document.close();
newWindow.focus();
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<style type="text/css">
<!--
.style4 {font-size: 10px}
-->
</style>
</head>
<body>
<!-- Start of StatCounter Code -->
<script type="text/javascript" language="javascript">
var sc_project=564685;
var sc_partition=4;
var sc_security="d8e72ee8";
</script>
<script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript><a href="http://www.statcounter.com/" target="_blank"><img src="http://c5.statcounter.com/counter.php?sc_project=564685&java=0&security=d8e72ee8" alt="counter" border="0"></a> </noscript>
<!-- End of StatCounter Code -->
<? draw_logo();?>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="795">
<tr><? draw_menu();?></tr>
<!--
<tr>
<td colspan=5 align=center><CENTER>Flash source required, without shopping cart this is the best transaction option we can think of. Step3 & 4 pending approval.</CENTER></td>
</tr> -->
</table>
<p>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="795">
<tr>
<td valign=top valign="top" width="295">
<? show_basic_instruction(); ?>
<? show_basic_instruction_right_way(); ?>
<? show_basic_instruction_wrong_way(); ?>
</td>
<td align="right" valign="top" width="500"><p><strong>Each Pirolette is 149.95</strong>; <span class="style4">s&h incl</span>.</p>
<table align=center class="cart" width="100%">
<tr>
<td class="header">
<a href="javascript:;" title="TURN YOUR HEAD- Directions" target="_top" onClick="MM_openBrWindow('http://www.turnyourhead.com/directions.htm','DIRECTIONS','width=455,height=455')">
DIRECTIONS</a><br>
<a href="includes/directions.pdf" target="new">
Printable Direction</a>
<hr align="right" width="130"></td>
<td colspan=2 class="header">
If you have your photo ready<br>
Complete your order in 3 Easy Steps
<hr align="right" width="250"></td></tr>
<tr><td class="subhdr" width="33%">Step 1</td>
<td class="subhdr" width="33%">Step 2</td>
<td class="subhdr" width="33%">Step 3</td>
</tr>
<tr><td valign="bottom"><? show_image_wood($tow)?></td>
<td valign="bottom"><? show_image_face($img)?></td>
<td valign="bottom"><? if ($tow && $img) show_name_email_phone_form();?></td>
</tr>
<tr><td valign="bottom" align=center><? reset_tow($tow); ?></td>
<td valign="bottom" align=center><? reset_img($img); ?></td>
<td valign="bottom" align=center></td>
</tr>
</table>
<hr align="right" width="465">
<? txn_step01_select_wood($tow); //QC:PASS?>
<? if ($tow) txn_step02_upload_imgs($tow,$img);?>
<? if ($_SESSION['paypal']) show_add_cart();
else txn_step04_show_txn_message(); ?>
</td>
</tr>
</table>
</body>
</html>