Page 2 of 2

Re: newbie - how do I make a pop-up window from my php code?

Posted: Mon Aug 11, 2008 3:31 pm
by dajawu
THe problem might be that when I posted my comment it translated my colon into that #58 crap. Try changing your javascript call to this: javascript:starhelp();

Re: newbie - how do I make a pop-up testing

Posted: Thu Aug 14, 2008 10:59 am
by techexpressinc
I put a new page on the web for testing donateprocessingpopup.html
and the php code is below




<?

/*
Program Name: donate.php
Author: Russ Neuman
Date Written: June 23, 2008
Description: Provides a form that web-site visitors can fill out and submit
information.
History: E-mail updated July 2008
*/

if (!isset($_REQUEST["submit"]))
{
echo "
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
<html>
<head>
<title>Donation Form</title>

<style>
input {background: #ffffff; color: #000000; font-family: sans-serif mt, arial fb, arial; border: #000000 solid 1px; }
select {background: #ffffff; color: #000000; font-family: sans-serif mt, arial fb, arial; border: #000000 solid 1px; }
textarea {background: #ffffff; color: #000000; font-family: sans-serif mt, arial fb, arial; border: #000000 solid 1px; }
p {font-family: sans-serif mt, arial fb, arial; font-size: 11pt; color: #000000; }
p.small {font-family: arial, tahoma; font-size: 10pt; color: #000000; }
</style>

<SCRIPT LANGUAGE='JavaScript'>
<!-- Original: Cyanide_7 (leo7278@hotmail.com) -->
<!-- Web Site: http://members.xoom.com/cyanide_7 -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
var isNN = (navigator.appName.indexOf('Netscape')!=-1);
function autoTab(input,len, e) {
var keyCode = (isNN) ? e.which : e.keyCode;
var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
if(input.value.length >= len && !containsElement(filter,keyCode)) {
input.value = input.value.slice(0, len);
input.form[(getIndex(input)+1) % input.form.length].focus();
}
function containsElement(arr, ele) {
var found = false, index = 0;
while(!found && index < arr.length)
if(arr[index] == ele)
found = true;
else
index++;
return found;
}
function getIndex(input) {
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form == input)index = i;
else i++;
return index;
}
return true;
}
// End -->
</script>

</head>
<body bgcolor=#548dad>

<form action='' method=post>
<table border=0 cellpadding=0 cellspacing=0>

<tr><td valign=middle><p>Amount: </p></td><td colspan=5 height=30><p><input type=text name=damount size=8 maxlength=8>(required)</p></td></tr>

<tr><td><p>Salutation:</p></td><td colspan=5 height=30><p><select name=salutation>
<option>Title</option>
<option value='Mr.'>Mr.</option>
<option value='Mr. & Mrs.'>Mr. & Mrs.</option>
<option value='Mrs.'>Mrs.</option>
<option value='Miss.'>Miss.</option>
<option value='Ms.'>Ms.</option>
<option value='Dr.'>Dr.</option>
<option value='Drs.'>Drs.</option>
<option value='Dr. & Mrs.'>Dr. & Mrs.</option>
<option value='Dr. & Mr.'>Dr. & Mr.</option>
<option value='Prof.'>Prof.</option>
<option value='Rev.'>Rev.</option>
<option value='Other'>Other</option>
</select></p></td></tr>

<tr><td valign=middle><p>Name as on card First: </p></td><td colspan=5 valign=middle height=30><p><input type=text name=fname size=10 maxlength=20> Last: <input type=text name=lname size=10 maxlength=25></p></td></tr>


<tr><td valign=middle><p>Company Name: </p></td><td colspan=5 height=30><p><input type=text name=cname size=30>(if applicable)</p></td></tr>
<tr><td valign=middle><p>Address: </p></td><td colspan=5 height=30><input type=text name=address size=30></td></tr>

<tr><td valign=middle><p>City: </p></td><td height=30><input type=text name=city size=20></td>
<td valign=middle><p><img src=Images/spacer.gif width=10>State: </p></td><td><input type=text name=state onKeyUp='return autoTab(this, 2, event);' size=2 maxlength=2></td>
<td valign=middle><p><img src=Images/spacer.gif width=10>Zip: </p></td><td><input type=text onKeyUp='return autoTab(this, 5, event);' name=zip size=5 maxlength=5></td></tr>

<tr><td valign=middle><p>Phone Number: </p></td><td colspan=5 valign=middle height=30><p>(<input type=text name=phone1 onKeyUp='return autoTab(this, 3, event);' size=3 maxlength=3>) <input type=text name=phone2 onKeyUp='return autoTab(this, 3, event);' size=3 maxlength=3>-<input type=text name=phone3 onKeyUp='return autoTab(this, 4, event);' size=4 maxlength=4>(required)</p></td></tr>


<tr><td valign=middle><p>E-Mail Address: </p></td><td colspan=5 height=30><p><input type=text name=email size=30>(required)</p></td></tr>

<tr><td><p>Payment type:</p></td><td colspan=5 height=30><p><select name=regarding>
<option value=''>Please Select One</option>
<option value='Visa'>Visa</option>
<option value='Discover'>Discover</option>
<option value='Mastercard'>Master Card</option>
<option value='AmericanExpress'>American Express</option>
</select></p></td></tr>

<tr><td><p>Credit Card number:</p></td><td colspan=5 height=30><p><input type=text name=ccnumber size=20 maxlength=24</p></td></tr>

<tr><td><p>Expiration mm/yy:</p></td><td colspan=5 height=30><p><input type=text name=ccdateexp size=5 maxlength=5></p></td></tr>

<SCRIPT language="javascript">
function starhelp()
{ window.open("starhelp.htm","starhelp","status=no, location=no,menubar=no,width=460,height=260,toolbar=no,titlebar=no");
}

</script>
<a href="javascript:starhelp();">Click here for help?</a>




<tr><td><p>3-digit Security Code:</p></td><td colspan=5 height=30><p><input type=text name=securitycode size=3 maxlength=3>(on back of card)</p></td></tr>


<tr><td><p>Monthly Option:<td colspan=5 height=30><p>&nbsp;</p></td></tr>
<tr><td colspan=6><input type=checkbox name=pledgemonthsbox size=1 maxlength=1>I would like to make a pledge of $<input type=text name=pledgeamt size=5 maxlength=8>to be paid in <input type=text name=pledgemonths size=2 maxlength=2>months.
</p></td></tr>


<tr><td><p>Tribute Information:</p></td></tr>


<tr><td><p>Comments:</p></td><td colspan=5 height=30><p>&nbsp;</p></td></tr>
<tr><td colspan=6><textarea name=comments cols=80 rows=2></textarea>

<tr><td colspan=6 valign=middle height=30><input type=submit name=submit value='Submit'> <input type=reset name=reset value='Clear Form'></td></tr>
</table>
</form>

</body>
</html>";
}
else
{

$first_name = isset($_REQUEST["fname"]) ? $_REQUEST["fname"] : "";
$last_name = isset($_REQUEST["lname"]) ? $_REQUEST["lname"] : "";
$d_amount = isset($_REQUEST["damount"]) ? $_REQUEST["damount"] : "";
$comp_name = isset($_REQUEST["cname"]) ? $_REQUEST["cname"] : "";
$address_full = isset($_REQUEST["address"]) ? $_REQUEST["address"] : "";
$city_name = isset($_REQUEST["city"]) ? $_REQUEST["city"] : "";
$state_name = isset($_REQUEST["state"]) ? $_REQUEST["state"] : "";
$zip_only = isset($_REQUEST["zip"]) ? $_REQUEST["zip"] : "";
$phone_a = isset($_REQUEST["phone1"]) ? $_REQUEST["phone1"] : "";
$phone_b = isset($_REQUEST["phone2"]) ? $_REQUEST["phone2"] : "";
$phone_c = isset($_REQUEST["phone3"]) ? $_REQUEST["phone3"] : "";
$email_add = isset($_REQUEST["email"]) ? $_REQUEST["email"] : "";
$regarding_sel = isset($_REQUEST["regarding"]) ? $_REQUEST["regarding"] : "";
$salutation_sel = isset($_REQUEST["salutation"]) ? $_REQUEST["salutation"] : "";
$cc_number = isset($_REQUEST["ccnumber"]) ? $_REQUEST["ccnumber"] : "";
$cc_dateexp = isset($_REQUEST["ccdateexp"]) ? $_REQUEST["ccdateexp"] : "";
$security_code = isset($_REQUEST["securitycode"]) ? $_REQUEST["securitycode"] : "";
$details_typed = isset($_REQUEST["comments"]) ? $_REQUEST["comments"] : "";


if(!empty($_POST)) extract($_POST);

$valid = 1;
$req_damount = '';
$req_name = '';
$req_phone1 = '';
$req_phone2 = '';
$req_phone3 = '';
$req_email = '';
$req_other = '';

if ($d_amount == '')
{
$valid = 0;
$req_damount = 'Amount';
}
if ($first_name == '')
{
$valid = 0;
$req_name = 'Your first Name';
}
if ($last_name == '')
{
$valid = 0;
$req_name = 'Your last Name';
}
if ($phone_a == '')
{
$valid = 0;
$req_phone1 = 'Your Area Code';
}
if ($phone_b == '')
{
$valid = 0;
$req_phone2 = 'The Second Three Digits of your Phone Number';
}
if ($phone_c == '')
{
$valid = 0;
$req_phone3 = 'The Last Four Digits of your Phone Number';
}
if ($email_add == '')
{
$valid = 0;
$req_email = 'Your E-Mail Address';
}


if ($valid == 0)
{
echo "
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
<html>
<head>
<title>Feedback Form - Missing Fields</title>

<style>
input {background: #ffffff; color: #000000; font-family: bell mt, californian fb, georgia; border: #000000 solid 1px; }
select {background: #FFFFFF; color: #000000; font-family: bell mt, californian fb, georgia; border: #000000 solid 1px; }
textarea {background: #ffffff; color: #000000; font-family: bell mt, californian fb, georgia; border: #000000 solid 1px; }
p {font-family: bell mt, californian fb, georgia; font-size: 11pt; color: #000000; }
p.small {font-family: verdana, tahoma; font-size: 7pt; color: #000000; }
</style>

</head>
<body bgcolor=#548dad>
<p>We apologize however it appears as though you left some required fields blank<br />
It looks like you left the following fields blank:
<br />
<br />
<b>
$req_name<br />
$req_damount<br />
$req_phone1<br />
$req_phone2<br />
$req_phone3<br />
$req_email<br />
$req_other<br />
<br />
</b>
It is very important that this information be provided so that we may get back to you<br />
as soon as possible.<br />
<br />
If you would like to try again click <a href='javascript:history.back()'>Here</a>
</p>
</body>
</html>";
}
else
{
$email = "neumans2000@yahoo.com, russ@techexpressinc.com";
// $email = "russ@techexpressinc.com";
$subject = "Donation from Website Regarding $regarding_sel";
$body = "A user on the website has filled in the donation form and sent the following information\n
Amount: $d_amount
Title: $salutation_sel
Lirst Name: $first_name
Last Name: $last_name
Company Name: $comp_name
Address: $address_full
City: $city_name State: $state_name Zip: $zip_only
Phone: ( $phone_a ) $phone_b - $phone_c
E-Mail Address: $email_add
\n
Credit Card Type: $regarding_sel
Credit Card Number: $cc_number
Credit Card Expiration Date: $cc_dateexp
Security Code: $security_code

\n
Comments:
$details_typed
";
mail($email, $subject, $body);

echo "
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
<html>
<head>
<title>Feedback Form - E-mail Sent</title>
<style>
input {background: #ffffff; color: #000000; font-family: bell mt, californian fb, georgia; border: #000000 solid 1px; }
select {background: #ffffff; color: #000000; font-family: bell mt, californian fb, georgia; border: #000000 solid 1px; }
textarea {background: #ffffff; color: #000000; font-family: bell mt, californian fb, georgia; border: #000000 solid 1px; }
p {font-family: bell mt, californian fb, georgia; font-size: 11pt; color: #000000; }
p.small {font-family: verdana, tahoma; font-size: 7pt; color: #000000; }
</style>

</head>
<body bgcolor=#548dad>
<p>Thank you for filling out the donation form.<br /> <br />
All donations will receive a confirmation by Turnstone.</p>
</body>
</html>
";
}
}

?>