Go Back   Novahq.net Forum > phphq.Net > phphq.Net Forums

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 10-24-2011, 10:54 PM
mccoy230023 is offline mccoy230023
Registered User

Join Date: Oct 2011
Posts: 4

phMailer.php Help Please......!

I'm trying to have the submit button on the phMailer form disable until my terms and agreement box is checked. Is there anyway to have this function written out in PHP and not JavaScript?
Reply With Quote
  #2  
Old 10-24-2011, 11:04 PM
mccoy230023 is offline mccoy230023
Registered User

Join Date: Oct 2011
Posts: 4

If there is no way to disable the submit button until checkbox is checked in PHP and not Script, is there a way to have the emailed form to include the fact that the checkbox was checked?
Reply With Quote
  #3  
Old 10-25-2011, 09:05 AM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,920

Yes the form can tell you if the checkbox was checked. You just need to add the variable to the body of the message. I can't think of a way to do it without using javascript unless you want the page to reload after the user clicks the box. That would erase anything they have already typed into the form though. Why not just use Javascript?
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #4  
Old 10-26-2011, 01:21 PM
mccoy230023 is offline mccoy230023
Registered User

Join Date: Oct 2011
Posts: 4

when I use JavaScript for some reason I don't get the email. I'm not sure if I have everything in the correct place or not. Everything works but for some reason I never get the email, here is how I have it written.

<script type="text/javascript">
var error="";
e_regex = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/;

function Checkit(theform) {
if(theform.yourname.value=="") {
error+="You did not enter your name\n";
}

if(theform.youremail.value=="") {
error+="You did not enter your email\n";
} else if(!e_regex.test(theform.youremail.value)) {
error+="Invalid email address\n";
}

if(theform.yourmessage.value=="") {
error+="You did not enter your message\n";
}

if(error) {
alert('**The form returned the following errors:**\n\n' + error);
error="";
return false;
} else {
return true;
}
}
</script>

<!------ script for disable submite button before checkbox is check ----->
<script type="text/javascript">
function apply()
{
document.phmailer.sub.disabled=true;
if(document.phmailer.chk.checked==true)
{
document.phmailer.sub.disabled=false;
}
if(document.phmailer.chk.checked==false)
{
document.phmailer.sub.enabled=false;
}
}
</script>




</head>
<center>
<body>

<div class="container">
<div class="header"><a href="index.html"><img src="NewLogo.jpg" width="1069" height="135" alt="logo" /></a>

<!-- end .header --></div>
<div>
<ul id="MenuBar1" class="MenuBarHorizontal">
<li><a href="index.html">Home</a> </li>
<li><a href="writers' guideline.html">Writers Guideline</a></li>
<li><a href="After the Service.php">After the Service</a> </li>
<li><a href="Contact Us.html">Contact Us</a></li>
</ul>
</div>
<div class="content">
<h1>After the Service </h1>
<p>How would you like to be possibly printed in the next <strong><em>Gospel Roads</em></strong> <strong><em>Magazine</em></strong> issue?</p>
<p>&ldquo;After the Service&rdquo; is the center spread in which <strong><em>Gospel Roads</em></strong> showcases YOU as you exit your church services. Smile because we know you just met with God!</p>
<p>Please keep your photos to four people or less. We need high resolution shots, so send photos that are 600 pixels or higher. </p>
<p>If your photo is chosen, please give us permission to print it in the magazine.<em><u> Please provide names of indiviuals in the photo and the location in which the photo was taken in the comment box provided below.</u></em> Sorry, there&rsquo;s no payment for either the photographer or those featured in the shot. However, we consider it an honor for you to allow your picture to grace the pages of an upcoming issue of Gospel Roads. </p>
<p>Your acknowledgement of the terms and condition below grants Gospel Roads the permission to print your picture, your name, the name of your church, and your city. We&rsquo;ll review the images for quality and notify you when and what issue your photo will be printed. ****</p>
<p><br />
</p>





<?If($display_message) {?>

<div align="center" class="error_message"><b><?=$display_message;?></b></div>
<br />

<?}?>

<?If($sent_mail!=true) {?>

<form method="post" action="<?=$_SERVER['PHP_SELF'];?>" enctype="multipart/form-data" name="phmailer" onsubmit="return Checkit(this);">
<table align="center" width="739" class="table" border="5" bordercolor="#8E740B" cellpadding="5">

<?If($allowattach > 0) {?>
<tr>
<td width="100%" class="attach_info" colspan="2">
<b>Please use file types"</b> <?=implode($allowtypes, ", ");?><br />
<b>Max size per photo:</b> <?=$max_file_size?>kb.<br />
<b>Max combined file size:</b> <?=$max_file_total?>kb.
</td>
</tr>
<?}?>

<tr>
<td width="30%" class="table_body">First & Last Name:</td>
<td width="70%" class="table_body"><input name="yourname" type="text" size="30" value="<?=stripslashes(htmlspecialchars($yourname) );?>" /><span class="error_message">*</span></td>
</tr>
<tr>
<td width="30%" class="table_body">Your E-Mail:</td>
<td width="70%" class="table_body"><input name="youremail" type="text" size="30" value="<?=stripslashes(htmlspecialchars($youremail ));?>" /><span class="error_message">*</span></td>
</tr>
<tr>
<td width="30%" class="table_body">Regarding:</td>
<td width="70%" class="table_body">

<?If($use_subject_drop AND is_array($subjects)) {?>
<select name="emailsubject" size="1">
<?while(list($key,$val)=each($subjects)) {?>

<option value="<?=intval($key);?>"><?=htmlspecialchars(str ipslashes($val));?></option>

<?}?>
</select>


<?} Else {?>

<input name="emailsubject" type="text" size="30" value="<?=stripslashes(htmlspecialchars($emailsubj ect));?>" />

<?}?>

</td>
</tr>

<?For($i=1;$i <= $allowattach; $i++) {?>
<tr>
<td width="30%" class="table_body">Attach File:</td>
<td width="70%" class="table_body"><input name="attachment[]" type="file" size="30" /></td>
</tr>
<?}?>

<tr>
<td colspan="2" width="100%" class="table_body">Comments:<span class="error_message">*</span><br />
<div align="center">
<textarea name="yourmessage" rows="8" cols="60"><?=stripslashes(htmlspecialchars($yourme ssage));?></textarea>
</div>
</td>
</tr>
<tr>
<!--------- code for the disabled submite button enable after checkbox is checked ---->
<td colspan="2" width="100%" class="table_footer">
<input type="checkbox" name="chk" onclick="apply()"/>
<a href="terms.pdf" target="_blank">Terms and Agreements</a> &nbsp;&nbsp;&nbsp;
<input type="hidden" name="submit" value="true" />
<input type="submit" name="sub" value="<?=$submitvalue;?>" disabled /> &nbsp;&nbsp;

<input type="reset" value="<?=$resetvalue;?>" />
</td>
</tr>
</table>
</form>

<?} Else {?>

<div align="center" class="thanks_message"><?=$thanksmessage;?></div>
<br />
<br />

<?}
Reply With Quote
  #5  
Old 10-26-2011, 05:57 PM
mccoy230023 is offline mccoy230023
Registered User

Join Date: Oct 2011
Posts: 4

Got it to work looks like I needed to keep the "<input type="hidden" name="submit" value="true" />" above the "<input type="submit" name="sub" value="<?=$submitvalue;?>" disabled /> " code which is how I have it on the code above.

Thanks for your help and an great mailing form you created.
Reply With Quote
  #6  
Old 10-26-2011, 06:24 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,920

Glad you got it figured out!
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

Forum Jump


All times are GMT -5. The time now is 08:13 AM.




Powered by vBulletin®