...

View Full Version : PHP Newbee Mail Form Issues



luke1438
04-11-2012, 12:08 AM
I am completely dumb when it comes to PHP but, need to use it for certain things; so, I muddle my way through it.

I need a contact form on my website and need to be able to put the form into several languages. Therefore, the prefabed ones on the form generating sites will not work for me. I found one that generates all the necessary PHP files and it worked great when I created it and ran it on their website (http://www.formmail-maker.com/generator.php). When I try to use it on my website it wants me to open the code file. I have tried it on several computers and it gives the same results.

I am obviously doing something wrong. You can see it here - http://www.fxaddictsforexfund.com/chinese/contact.html

I have also attached the code file.

Thanks in advance
Luke


<?php

# This block must be placed at the very top of page.
# --------------------------------------------------
require_once( dirname(__FILE__).'/form.lib.php' );
phpfmg_display_form();
# --------------------------------------------------



function phpfmg_form( $sErr = false ){
$style=" class='form_text' ";

?>

<form name="frmFormMail" action='' method='post' enctype='multipart/form-data' onsubmit='return fmgHandler.onsubmit(this);'>
<input type='hidden' name='formmail_submit' value='Y'>
<div id='err_required' class="form_error" style='display:none;'>
<label class='form_error_title'>Please check the required fields</label>
</div>



<ol class='phpfmg_form' >

<li class='field_block' id='field_0_div'><div class='col_label'>
<label class='form_field'>First Name</label> <label class='form_required' >*</label> </div>
<div class='col_field'>
<input type="text" name="field_0" id="field_0" value="<?php phpfmg_hsc("field_0", ""); ?>" class='text_box'>
<div id='field_0_tip' class='instruction'></div>
</div>
</li>

<li class='field_block' id='field_1_div'><div class='col_label'>
<label class='form_field'>Last Name</label> <label class='form_required' >*</label> </div>
<div class='col_field'>
<input type="text" name="field_1" id="field_1" value="<?php phpfmg_hsc("field_1", ""); ?>" class='text_box'>
<div id='field_1_tip' class='instruction'></div>
</div>
</li>

<li class='field_block' id='field_2_div'><div class='col_label'>
<label class='form_field'>Your Email Address</label> <label class='form_required' >*</label> </div>
<div class='col_field'>
<input type="text" name="field_2" id="field_2" value="<?php phpfmg_hsc("field_2", ""); ?>" class='text_box'>
<div id='field_2_tip' class='instruction'></div>
</div>
</li>

<li class='field_block' id='field_3_div'><div class='col_label'>
<label class='form_field'>Your Message</label> <label class='form_required' >*</label> </div>
<div class='col_field'>
<textarea name="field_3" id="field_3" rows=4 cols=50 class='text_area'><?php phpfmg_hsc("field_3"); ?></textarea>

<div id='field_3_tip' class='instruction'></div>
</div>
</li>


<li class='field_block' id='phpfmg_captcha_div'>
<div class='col_label'><label class='form_field'>Security Code:</label> <label class='form_required' >*</label> </div><div class='col_field'>
<?php phpfmg_show_captcha(); ?>
</div>
</li>


<li>
<div class='col_label'>&nbsp;</div>
<div class='form_submit_block col_field'>

<input type='submit' value='Submit' class='form_button'>
<span id='phpfmg_processing' style='display:none;'>
<img id='phpfmg_processing_gif' src='<?php echo PHPFMG_ADMIN_URL . '?mod=image&amp;func=processing' ;?>' border=0 alt='Processing...'> <label id='phpfmg_processing_dots'></label>
</span>
</div>
</li>

</ol>




</form>




<?php

phpfmg_javascript($sErr);

}
# end of form




function phpfmg_form_css(){
?>
<style type='text/css'>

body{
margin-left: 18px;
margin-top: 18px;
}

body{
font-family : Verdana, Arial, Helvetica, sans-serif;
font-size : 13px;
color : #474747;
background-color: transparent;
}

select, option{
font-size:13px;
}

ol.phpfmg_form{
list-style-type:none;
padding:0px;
margin:0px;
}

ol.phpfmg_form li{
margin-bottom:5px;
clear:both;
display:block;
overflow:hidden;
width: 100%
}


.form_field, .form_required{
font-weight : bold;
}

.form_required{
color:red;
margin-right:8px;
}

.field_block_over{
}

.form_submit_block{
padding-top: 3px;
}

.text_box, .text_area, .text_select {
width:300px;
}

.text_area{
height:80px;
}

.form_error_title{
font-weight: bold;
color: red;
}

.form_error{
background-color: #F4F6E5;
border: 1px dashed #ff0000;
padding: 10px;
margin-bottom: 10px;
}

.form_error_highlight{
background-color: #F4F6E5;
border-bottom: 1px dashed #ff0000;
}

div.instruction_error{
color: red;
font-weight:bold;
}

hr.sectionbreak{
height:1px;
color: #ccc;
}

#one_entry_msg{
background-color: #F4F6E5;
border: 1px dashed #ff0000;
padding: 10px;
margin-bottom: 10px;
}

<?php phpfmg_text_align();?>



</style>

<?php
}
# end of css

# By: formmail-maker.com
?>

mlseim
04-11-2012, 01:33 AM
The web server is configured to only run PHP scripts on files with a .php extension.

This is your URL:
... fxaddictsforexfund.com/chinese/contact.html

See? the extension is .html

Change it to .php

If that isn't possible, or you really want to retain .html, you can use the
.htaccess file to force the server to process .php scripts using .html.
You can ask your webhost about that, since not all webhosts allow it,
and messing with .htaccess is something you should only do if you know what
you're doing.

For now, use .php file extensions on any web pages that use PHP



.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum