PHP submit query not working, - php
I have a very extensive and large web form that users can submit to a PostGreSQL database of mine. I'm having trouble completing the functionality though. I have smaller web forms that this works a treat with but I'm getting an error - Query failed: ERROR: INSERT has more target columns than expressions
Now, of course, I can interpret what this means but I've looked through the file time and time again and cannot see anything wrong with the web form at all. Could I get a few more pairs of eyes on the web form itself and the PHP submit query. I'm also looking for advice on how to make the PHP script smaller, seems a very unprofessional way that I am carrying out the functionality. Can any of you identify which column/variable is out of place.
Web form.html
<form name="availability" method="post" action="auth/avaisubmit.php">
<h5>7.1 Orientation</h5>
<label>Are floor-plans or maps available?</label>
<select name="floorplans">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label>Specify what formats</label>
<textarea cols="50" rows="4" name="format_specify"></textarea> <br />
<label>Are videos with British Sign Language(BSL) available?</label>
<select name="videos_bsl">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label>Do you highlight what ISN'T accessible?</label>
<select name="highlight_not_accessible">
<option value="Yes">Yes</option>
<option value="No">No</option>
<option value="Not applicable">Not applicable</option>
</select> <br /> <br />
<label>Do staff offer a browsing collections service? (i.e. where staff can browse collections and retrieve items for disabled visitors?</label>
<select name="browsing_service">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label>If yes, please add more details(for example if it needs to be pre-booked).</label>
<textarea cols="50" rows="4" name="more_details"></textarea> <br />
<h5> 7.2 Alternative Formats </h5>
<label>Is an audio system available?</label>
<select name="audio_system">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<!--ADD COLUMNS BACK INTO TYPESCRIPT-->
<label>What type of audio system is it?</label>
<input type="text" name="audio_system_type" /> <br />
<label>Where is the audio system available?</label>
<input type="text" name="where_audio" /> <br />
<label>Is there a text version? </label>
<select name="text_version">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label>Text version - Description </label>
<textarea cols="50" rows="4" name="text_version_description"></textarea> <br />
<label>Are verbal descriptions<sup>*1</sup> available?</label>
<select name="verbal">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label>Verbal description - Description</label>
<textarea cols="50" rows="4" name="verbal_description"></textarea> <br />
<label>Are Tactile<sup>*2</sup> models available?</label>
<select name="tactile">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label>Tactile models - Description</label>
<textarea cols="50" rows="4" name="tactile_description"></textarea> <br />
<label>Are replicas<sup>*3</sup> available? (including digital copies of documents)</label>
<select name="replicas">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label>Replicas - Description</label>
<textarea cols="50" rows="4" name="replicas_description"></textarea> <br />
<label>Are DAISY (digital talking books)<sup>*4</sup> available?</label>
<select name="daisy">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label>DAISY - Description</label>
<textarea cols="50" rows="4" name="daisy_description"></textarea> <br />
<label>Are CDs<sup>*5</sup> available?</label>
<select name="cd">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label> CDs - Description </label>
<textarea cols="50" rows="4" name="cd_description"></textarea> <br />
<label> Are DVDs<sup>*6</sup> available? </label>
<select name="dvd">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label> DVDs - Description </label>
<textarea cols="50" rows="4" name="dvd_description"></textarea> <br />
<label> Are raised images<sup>*7</sup> available?</label>
<select name="raised_images">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label> Raised images - Description </label>
<textarea cols="50" rows="4" name="raised_images_description"></textarea> <br />
<label> Is tape available</label>
<select name="tape">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label> Tape - Description </label>
<textarea cols="50" rows="4" name="tape_description"></textarea> <br />
<label>Please list any other formats have, e.g. MP3 etc</label>
<textarea cols="50" rows="4" name="other_formats"></textarea> <br />
<label>Is a format conversion service<sup>*8</sup> available?</label>
<select name="format_conversion">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label> Format conversion service - Description </label>
<textarea cols="50" rows="4" name="format_conversion_description"></textarea> <br />
<h5> 7.3 ICT </h5>
<label>Do you have Kiosks/interactives?</label>
<select name="kiosks">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label>How many Kiosks do you have?</label>
<input type="text" name="num_kiosks" /> <br />
<label> How are Kiosks/interactives accessible to disabled visitors?</label>
<textarea cols="50" rows="4" name="accessible_kiosks"></textarea> <br />
<label> Where are the Kiosks/interactives located?</label>
<textarea cols="50" rows="4" name="location_kiosks"></textarea> <br />
<label>What senses do they stimulate?</label>
<select name="senses">
<option value="Hearing">Hearing</option>
<option value="Sight">Sight</option>
<option value="Touch">Touch</option>
<option value="Smell">Smell</option>
<option value-"Taste">Taste</option>
</select> <br /> <br />
<label> Are there videos with captions and audio descriptions?</label>
<select name="videos_captions_audios">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label> How many captioned or described videos are available?</label>
<input type="text" name="num_captioned_videos" /> <br />
<label> Where are the captioned or described videos located? </label>
<input type="text" name="location_captioned_videos" /> <br />
<label>Are there fixed point or portable audio guides or interpretation?</label>
<select name="audio_guides">
<option name="Yes">Yes</option>
<option name="No">No</option>
</select> <br /> <br />
<label>How many of these are available?</label>
<input type="text" name="num_audio_guides" /> <br />
<label>Where are they located?</label>
<input type="text" name="location_audio_guides" /> <br />
<label>Are transcripts of audio/video available?</label>
<select name="transcripts">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label>How many of these are available?</label>
<input type="text" name="num_transcripts" /> <br />
<label> Please give details </label>
<textarea cols="50" rows="4" name="details_transcripts"></textarea> <br />
<label>Do visitors/users have access to ICT equipment as part of their visit?</label>
<select name="access_ict">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label>Are there height-adjustable tables and chairs?</label>
<select name="tables_chairs">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label>What size is the screen?</label>
<textarea cols="50" rows="4" name="screen_size"></textarea> <br />
<label>Are there monitors mounted on universal arms for viewing at any angle?</label>
<select name="monitor_universal">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label>Is there a selection of mice, ketboards and joysticks with wired and wireless connection?</label>
<select name="mice_keyboards_joysticks">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label>Are there standalone text to speech machines?<sup>*9</sup> </label>
<select name="text_to_speech">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label> Description - Text to speech machines</label>
<textarea rows="4" cols="50" name="text_to_speech_description"> </textarea> <br />
<label>Is there closed circuit TV magnification equipment with X-Y tables?*</label>
<select name="closed_circuit_tv">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label>Is there an accessible Website?</label>
<select name="website">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label>Tested by:</label> <input type="text" name="accessible_website_tester" /> <br />
<label>Have you carried out access testing with disabled website users?</label>
<select name="access_testing">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label>Tested by:</label> <input type="text" name="accessible_testing_tester" /> <br />
<label>Can you easily increase font size?</label>
<select name="font_size">
<option value="Yes">Yes</option>
<option value="No">No<option>
</select> <br /> <br />
<label>Are pictures and text described?</label>
<select name="pictures_text_described">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label>Does this include downloadable resources in alternative formats?</label>
<select name="downloadables">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label>Downloadbles - Description</label> <input type="text" name="downloadables_description" /> <br />
<label>Is there website available on-site?</label>
<select name="website_onsite">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label>Where:</label> <input type="text" name="website_where" /> <br />
<label>Do you provide automatic page turners?</label>
<select name="auto_page_turners">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label>Add any other assistive technologies that you use to increase access</label> <input type="text" name="other_technologies" /> <br />
<label>Do you offer different assistive technologies?</label>
<select name="other_different">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select> <br /> <br />
<label>If yes, please list some examples<sup>*10</sup> </label>
<textarea cols="50" rows="4" name="other_different_examples"></textarea> <br />
<input class="button" type="submit" value="Save"> <br />
</form>
PHP Submit.php
<?php
session_start();
if(isset($_SESSION['SESS_NAME']))
{
$_SESSION['SESS_NAME'] = $_SESSION['SESS_NAME'];
}
else
{
$_SESSION['SESS_NAME'] = $_POST['SESS_NAME'];
}
$username = $_SESSION["SESS_NAME"];
$floorplans = $_POST["floorplans"];
$format = $_POST["format_specify"];
$videosbsl = $_POST["videos_bsl"];
$highlight = $_POST["highlight_not_accessible"];
$browsing = $_POST["browsing_service"];
$details = $_POST["more_details"];
$audio = $_POST["audio_system"];
$whereaudio = $_POST["where_audio"];
$textversion = $_POST["text_version"];
$textversiondesc = $_POST["text_version_description"];
$verbal = $_POST["verbal"];
$verbaldesc = $_POST["verbal_description"];
$tactile = $_POST["tactile"];
$tactiledesc = $_POST["tactile_description"];
$replicas = $_POST["replicas"];
$replicasdesc = $_POST["replicas_description"];
$daisy = $_POST["daisy"];
$daisydesc = $_POST["daisy_description"];
$cd = $_POST["cd"];
$cddesc = $_POST["cd_description"];
$dvd = $_POST["dvd"];
$dvddesc = $_POST["dvd_description"];
$raised = $_POST["raised_images"];
$raiseddesc = $_POST["raised_images_description"];
$tape = $_POST["tape"];
$tapedesc = $_POST["tape_description"];
$other = $_POST["other_formats"];
$formatconv = $_POST["format_conversion"];
$fcdesc = $_POST["format_conversion_description"];
$kiosks = $_POST["kiosks"];
$numkiosks = $_POST["num_kiosks"];
$accesskiosks = $_POST["accessible_kiosks"];
$locationkiosks = $_POST["location_kiosks"];
$senses = $_POST["senses"];
$vca = $_POST["videos_captions_audios"];
$numvca = $_POST["num_captioned_videos"];
$locvca = $_POST["location_captioned videos"];
$audioGuide = $_POST["audio_guides"];
$numAG = $_POST["num_audio_guides"];
$locAG = $_POST["location_audio_guides"];
$transcripts = $_POST["transcripts"];
$numtranscripts = $_POST["num_transcripts"];
$detailtranscripts = $_POST["details_transcripts"];
$accessICT = $_POST["access_ict"];
$tableschairs = $_POST["tables_chairs"];
$screensize = $_POST["screen_size"];
$monitors = $_POST["monitor_universal"];
$mkj = $_POST["mice_keyboards_joysticks"];
$textspeech = $_POST["text_to_speech"];
$textspeechdesc = $_POST["text_to_speech_description"];
$circutTV = $_POST["closed_circuit_tv"];
$website = $_POST["website"];
$tester = $_POST["accessible_website_tester"];
$accessTesting = $_POST["access_testing"];
$accessibleTester = $_POST["accessible_testing_tester"];
$fontsize = $_POST["font_size"];
$pictexts = $_POST["pictures_text_described"];
$downloadables = $_POST["downloadables"];
$downloadablesdesc = $_POST["downloadables_description"];
$webonsite = $_POST["website_onsite"];
$webwhere = $_POST["website_where"];
$pageturners = $_POST["auto_page_turners"];
$othertech = $_POST["other_technologies"];
$otherdiff = $_POST["other_different"];
$otherdiffeg = $_POST["other_different_examples"];
$systemaudio = $_POST["audio_system_type"];
$conn = pg_connect("db_string");
$user = pg_query("SELECT * FROM staff WHERE username='$username'");
$user_row = pg_fetch_assoc($user);
$user_res = $user_row['s_id'];
var_dump($user_res);
$check = pg_query("SELECT name FROM availability");
$num_rows = pg_num_rows($check);
if($num_rows == 1)
{
$res = pg_query("UPDATE availability SET (floorplans_maps, formats, videos_with_bsl, highlight_not_accessible, browsing_collection_service,
more_detail, audio_system, where_audio_system, text_version, text_version_description, verbal, verbal_description,
tactile_models, tactile_models_description, replicas, replicas_description, daisy, daisy_description, cd, cd_description, dvd, dvd_description, raised_images, raised_images_descriptipon, tape, tape_description,
other_formats, format_conversion, format_conversion_description, kiosks, num_kiosks, accessible_kiosks, location_kiosks, senses,
video_captions_audio_description, num_captioned_videos, location_captioned_videos, audio_guides, num_audio_guides, location_audio_guides,
transcripts, num_transcripts, details_transcripts, access_to_ict, height_adjust_chairs, screen_size, monitor_universal_arms, mice_keyboards_joysticks,
text_to_speech_machines, text_to_speech_machines_description, closed_circuit_tv, accessible_website, accessible_website_tester, access_testing, access_testing_tester,
font_size_adjustment, pictures_text_described, downloadables_included, downloadables_description, website_onsite, website_where, auto_page_turner, other_technologies,
offer_different, offer_different_examples, type_audio_system) =
('$floorplans',
'$format',
'$videosbsl',
'$highlight',
'$browsing',
'$details',
'$audio',
'$whereaudio',
'$textversion',
'$textversiondesc',
'$verbal',
'$verbaldesc',
'$tactile',
'$tactiledesc',
'$replicas',
'$replicasdesc',
'$daisy',
'$daisydesc',
'$cd',
'$cddesc',
'$dvd',
'$dvddesc',
'$raised',
'$raiseddesc',
'$tape',
'$tapedesc',
'$other',
'$formatconv',
'$fcdesc',
'$kiosks',
'$numkiosks',
'$accesskiosks',
'$locationkiosks',
'$senses',
'$vca',
'$numvca',
'$locvca',
'$audioGuide',
'$numAG',
'$locAG',
'$transcripts',
'$numtranscripts',
'$detailtranscripts',
'$accessICT',
'$tableschairs',
'$screensize',
'$monitors',
'$mkj',
'$textspeech',
'$textspeechdesc',
'$circutTV',
'$website',
'$tester',
'$accessTesting',
'$accessibleTester',
'$fontsize',
'$pictexts',
'$downloadables',
'$downloadablesdesc'
'$webonsite',
'$webwhere',
'$pageturners',
'$othertech',
'$otherdiff',
'$otherdiffeg',
'$systemaudio') WHERE name='$user_res'");
}
elseif($num_rows == 0)
{
$res = pg_query("INSERT INTO availability (floorplans_maps, formats, videos_with_bsl, highlight_not_accessible, browsing_collection_service,
more_detail, audio_system, where_audio_system, text_version, text_version_description, verbal, verbal_description,
tactile_models, tactile_models_description, replicas, replicas_description, daisy, daisy_description, cd, cd_description, dvd, dvd_description, raised_images, raised_images_descriptipon, tape, tape_description,
other_formats, format_conversion, format_conversion_description, kiosks, num_kiosks, accessible_kiosks, location_kiosks, senses,
video_captions_audio_description, num_captioned_videos, location_captioned_videos, audio_guides, num_audio_guides, location_audio_guides,
transcripts, num_transcripts, details_transcripts, access_to_ict, height_adjust_chairs, screen_size, monitor_universal_arms, mice_keyboards_joysticks,
text_to_speech_machines, text_to_speech_machines_description, closed_circuit_tv, accessible_website, accessible_website_tester, access_testing, access_testing_tester,
font_size_adjustment, pictures_text_described, downloadables_included, downloadables_description, website_onsite, website_where, auto_page_turner, other_technologies,
offer_different, offer_different_examples, name, type_audio_system) VALUES (
'$floorplans',
'$format',
'$videosbsl',
'$highlight',
'$browsing',
'$details',
'$audio',
'$whereaudio',
'$textversion',
'$textversiondesc',
'$verbal',
'$verbaldesc',
'$tactile',
'$tactiledesc',
'$replicas',
'$replicasdesc',
'$daisy',
'$daisydesc',
'$cd',
'$cddesc',
'$dvd',
'$dvddesc',
'$raised',
'$raiseddesc',
'$tape',
'$tapedesc',
'$other',
'$formatconv',
'$fcdesc',
'$kiosks',
'$numkiosks',
'$accesskiosks',
'$locationkiosks',
'$senses',
'$vca',
'$numvca',
'$locvca',
'$audioGuide',
'$numAG',
'$locAG',
'$transcripts',
'$numtranscripts',
'$detailtranscripts',
'$accessICT',
'$tableschairs',
'$screensize',
'$monitors',
'$mkj',
'$textspeech',
'$textspeechdesc',
'$circutTV',
'$website',
'$tester',
'$accessTesting',
'$accessibleTester',
'$fontsize',
'$pictexts',
'$downloadables',
'$downloadablesdesc'
'$webonsite',
'$webwhere',
'$pageturners',
'$othertech',
'$otherdiff',
'$otherdiffeg',
'$user_res',
'$systemaudio')");
}
pg_close($conn);
?>
Again huge apologies for how long the source code is. Just can't seem to figure out the error.
It's occurring because you've missed a comma after the '$downloadablesdesc' entry in both queries.
Consequently, the counts don't match up:
'$downloadables',
'$downloadablesdesc' <-- should be a comma here
'$webonsite',
You can confirm this using the JSfiddle I built to check:
http://jsfiddle.net/SpAm/Z7KzA/1/
Paste these (your columns) into the box on the left:
floorplans_maps, formats, videos_with_bsl, highlight_not_accessible, browsing_collection_service,more_detail, audio_system, where_audio_system, text_version, text_version_description, verbal, verbal_description,tactile_models, tactile_models_description, replicas, replicas_description, daisy, daisy_description, cd, cd_description, dvd, dvd_description, raised_images, raised_images_descriptipon, tape, tape_description,other_formats, format_conversion, format_conversion_description, kiosks, num_kiosks, accessible_kiosks, location_kiosks, senses,video_captions_audio_description, num_captioned_videos, location_captioned_videos, audio_guides, num_audio_guides, location_audio_guides,transcripts, num_transcripts, details_transcripts, access_to_ict, height_adjust_chairs, screen_size, monitor_universal_arms, mice_keyboards_joysticks,text_to_speech_machines, text_to_speech_machines_description, closed_circuit_tv, accessible_website, accessible_website_tester, access_testing, access_testing_tester,font_size_adjustment, pictures_text_described, downloadables_included, downloadables_description, website_onsite, website_where, auto_page_turner, other_technologies,offer_different, offer_different_examples, type_audio_system
And these (your values) into the box on the right, and click the button:
'$floorplans',
'$format',
'$videosbsl',
'$highlight',
'$browsing',
'$details',
'$audio',
'$whereaudio',
'$textversion',
'$textversiondesc',
'$verbal',
'$verbaldesc',
'$tactile',
'$tactiledesc',
'$replicas',
'$replicasdesc',
'$daisy',
'$daisydesc',
'$cd',
'$cddesc',
'$dvd',
'$dvddesc',
'$raised',
'$raiseddesc',
'$tape',
'$tapedesc',
'$other',
'$formatconv',
'$fcdesc',
'$kiosks',
'$numkiosks',
'$accesskiosks',
'$locationkiosks',
'$senses',
'$vca',
'$numvca',
'$locvca',
'$audioGuide',
'$numAG',
'$locAG',
'$transcripts',
'$numtranscripts',
'$detailtranscripts',
'$accessICT',
'$tableschairs',
'$screensize',
'$monitors',
'$mkj',
'$textspeech',
'$textspeechdesc',
'$circutTV',
'$website',
'$tester',
'$accessTesting',
'$accessibleTester',
'$fontsize',
'$pictexts',
'$downloadables',
'$downloadablesdesc'
'$webonsite',
'$webwhere',
'$pageturners',
'$othertech',
'$otherdiff',
'$otherdiffeg',
'$systemaudio'
This is the outcome:
floorplans_maps -- '$floorplans'
formats -- '$format'
videos_with_bsl -- '$videosbsl'
highlight_not_accessible -- '$highlight'
browsing_collection_service -- '$browsing'
more_detail -- '$details'
audio_system -- '$audio'
where_audio_system -- '$whereaudio'
text_version -- '$textversion'
text_version_description -- '$textversiondesc'
verbal -- '$verbal'
verbal_description -- '$verbaldesc'
tactile_models -- '$tactile'
tactile_models_description -- '$tactiledesc'
replicas -- '$replicas'
replicas_description -- '$replicasdesc'
daisy -- '$daisy'
daisy_description -- '$daisydesc'
cd -- '$cd'
cd_description -- '$cddesc'
dvd -- '$dvd'
dvd_description -- '$dvddesc'
raised_images -- '$raised'
raised_images_descriptipon -- '$raiseddesc'
tape -- '$tape'
tape_description -- '$tapedesc'
other_formats -- '$other'
format_conversion -- '$formatconv'
format_conversion_description -- '$fcdesc'
kiosks -- '$kiosks'
num_kiosks -- '$numkiosks'
accessible_kiosks -- '$accesskiosks'
location_kiosks -- '$locationkiosks'
senses -- '$senses'
video_captions_audio_description -- '$vca'
num_captioned_videos -- '$numvca'
location_captioned_videos -- '$locvca'
audio_guides -- '$audioGuide'
num_audio_guides -- '$numAG'
location_audio_guides -- '$locAG'
transcripts -- '$transcripts'
num_transcripts -- '$numtranscripts'
details_transcripts -- '$detailtranscripts'
access_to_ict -- '$accessICT'
height_adjust_chairs -- '$tableschairs'
screen_size -- '$screensize'
monitor_universal_arms -- '$monitors'
mice_keyboards_joysticks -- '$mkj'
text_to_speech_machines -- '$textspeech'
text_to_speech_machines_description -- '$textspeechdesc'
closed_circuit_tv -- '$circutTV'
accessible_website -- '$website'
accessible_website_tester -- '$tester'
access_testing -- '$accessTesting'
access_testing_tester -- '$accessibleTester'
font_size_adjustment -- '$fontsize'
pictures_text_described -- '$pictexts'
downloadables_included -- '$downloadables'
downloadables_description -- '$downloadablesdesc' '$webonsite'
website_onsite -- '$webwhere'
website_where -- '$pageturners'
auto_page_turner -- '$othertech'
other_technologies -- '$otherdiff'
offer_different -- '$otherdiffeg'
offer_different_examples -- '$systemaudio'
type_audio_system -- undefined
Related
Trying to display a div using PHP
Good morning, I’m trying to display a div containing a form using PHP. I’m not using JavaScript because my teacher has told me to use PHP instead. I have two buttons and I’m using isset to determine which one is clicked. The functions execute and echo the correct identifying text, (“This is form X”), but the actual forms don’t display. Initially, in CSS, the forms are displayed like so: .parent .copyarea #formHELP { display: none; } .parent .copyarea #formFEEDBACK { display: none; } In HTML, they are the same. Class parent. Class copyarea. ID formFEEDBACK and formHELP. In PHP, this is the function I’m using: <?php echo "<h1> Hello PHP. </h1>"; if(isset($_GET['formHELPbutton'])) { echo "Hello Form Help."; echo "<div id='formHELP' style='display: block'>"; } if(isset($_GET['formFEEDBACKbutton'])) { echo "Hello Form Feedback."; echo "<div id='formFEEDBACK' style='display: block'>"; } ?> And like I mentioned, I"m getting the “Hello Form X”, so the function is working, but my echo div line is off somehow. Please advise? Thank you! Edit: This is the entire content of the PHP echo statement, with the div inside: if(isset($_GET['formHELPbutton'])) { echo "Hello Form Help."; echo ' <div id="formHELP"> <article> <h1>Help Request Form</h1> <form name="formHELP" action="http://cdlwebsysdev.esc-atsystems.net//WSD/form-to-email.php" onsubmit="return validateHELPForm()" method="post"> <p>Please take a moment to fill out and submit this help form. <br /></p> <p> <label for="FromAddressH">*Enter your email (required).</label> <input type="text" id="FromAddressH" name="FromAddressH" minlength="5" maxlength="40" size="30"><br /><br /> <label for="telnumberH">Enter your telephone number.</label> <input type="text" id="telnumberH" name="telnumberH" minlength="10" maxlength="20" size="30"><br /><br /> <label for="firstnameH">*Enter your first name (required).</label> <input type="text" id="firstnameH" name="firstnameH" minlength="2" maxlength="20" size="20"><br /><br /> <label for="lastnameH">*Enter your last name (required).</label> <input type="text" id="lastnameH" name="lastnameH" minlength="2" maxlength="30" size="30"><br /><br /> Your Mailing Address: <br /><br /> <label for="streetH">Enter your street.</label> <input type="text" id="streetH" name="streetH" minlength="2" maxlength="50" size="50"><br /><br /> <label for="cityH">Enter your city.</label> <input type="text" id="cityH" name="cityH" minlength="2" maxlength="50" size="50"><br /><br /> <label for="stateH">Enter your state.</label> <select id="stateH" name="stateH"> <option value="AL">AL</option> <option value="AK">AK</option> <option value="AR">AR</option> <option value="AS">AS</option> <option value="AZ">AZ</option> <option value="CA">CA</option> <option value="CO">CO</option> <option value="CT">CT</option> <option value="DC">DC</option> <option value="DE">DE</option> <option value="FL">FL</option> <option value="GA">GA</option> <option value="GU">GU</option> <option value="HI">HI</option> <option value="IA">IA</option> <option value="ID">ID</option> <option value="IL">IL</option> <option value="IN">IN</option> <option value="KS">KS</option> <option value="KY">KY</option> <option value="LA">LA</option> <option value="MA">MA</option> <option value="MD">MD</option> <option value="ME">ME</option> <option value="MI">MI</option> <option value="MN">MN</option> <option value="MO">MO</option> <option value="MP">MP</option> <option value="MS">MS</option> <option value="MT">MT</option> <option value="NC">NC</option> <option value="NE">NE</option> <option value="NH">NH</option> <option value="NJ">NJ</option> <option value="NM">NM</option> <option value="NV">NV</option> <option value="NY">NY</option> <option value="ND">ND</option> <option value="OH">OH</option> <option value="OK">OK</option> <option value="OR">OR</option> <option value="PA">PA</option> <option value="PR">PR</option> <option value="RI">RI</option> <option value="SC">SC</option> <option value="SD">SD</option> <option value="TN">TN</option> <option value="TX">TX</option> <option value="UT">UT</option> <option value="UM">UM</option> <option value="VT">VT</option> <option value="VA">VA</option> <option value="VI">VI</option> <option value="WA">WA</option> <option value="WI">WI</option> <option value="WV">WV</option> <option value="WY">WY</option> </select> <br /> <br /> <label for="postcodeH">Enter your postal code.</label> Postal Code: <input type="text" id="postcodeH" name="postcodeH" minlength="2" maxlength="10" size="10"><br /><br /> <label for="countryH">Enter your country code.</label> Country Code: <input type="text" id="countryH" name="countryH" minlength="2" maxlength="3" size="3"><br /><br /> <label for="helpH">*Please tell me what you require help with (required):</label> <textarea name="helpH" id="helpH" rows="10" cols="80"></textarea> <br /> <br /> <br /> <br /> <div class="form-group options"> How would you like to be contacted? (Both boxes can be checked) : <label for="contactphoneH">Phone</label> <input type="checkbox" id="contactphoneH" name="contactphoneH"> <label for="contactemailH"> Email</label> <input type="checkbox" id="contactemailH" name="contactemailH"> <br> </div> <br /> <br /> <input type="hidden" name="ToAddress" value="markholley4#gmail.com" /> <!-- TODO Change to todd.wolfe#esc.edu when final version published. --> <input type="hidden" name="CCAddress" value="markholley4#gmail.com" /> <input type="hidden" name="Subject" value="WSD: Module 3 Assignment - Web Form for Mark Holley" /> <button type="submit" value="SubmitH">Submit</button> <button type="reset" value="ResetH">Reset</button> <br /> <br /> </form> </article> </div>';
Your Div elements needs a opening div tag( like you already have) but you are missing the closing one. Also if a div has no content, it won't have any width or height, so you won't see anything, you can test the code below, just added some color to the background so you can see the div. ` if(isset($_GET['formHELPbutton'])) { echo 'Hello Form Help.'; echo '<div id="formHELP" style="display:block; width:500px; height:500px; background-color:red">test form help </div>'; } if(isset($_GET['formFEEDBACKbutton'])) { echo 'Hello Form Feedback.'; echo '<div id="formFEEDBACK" style="display:block; width:500px; height:500px; background-color:red"> test form feedback </div>'; } ` <div id="formHELP" style="display:block; width:500px; height:500px; background-color:red">test form help </div>
Form Data Not posting to database
Can Anyone see what is wrong with the below code. When I submit the data using HTML form I get as expected the confirmation to confirm Registered. However, when I check the database its not there! I have checked the names are the same names of each input is correct and can confirm the database is connected successfully, along with the names of the database columns ect... Any help would be much appreciated. <?php if (isset($_POST['carrierinsert'])) { $acc = $_POST['acc']; $sql = "SELECT cariers.acc FROM cariers WHERE cariers.acc ='$acc'"; $result = $db->query($sql); if($result->num_rows > 0) { echo "<font color='red'>Carrier Already exits</font>"; $sql = "INSERT INTO cariers ( `reg`, `acc`, `accstatus`, `carramid`, `carrfloor`, `pay`, `comms`) VALUES ( '".$db->real_escape_string($_POST['reg'])."', '".$db->real_escape_string($_POST['acc'])."', '".$db->real_escape_string($_POST['accstatus'])."', '".$db->real_escape_string($_POST['carramid'])."', '".$db->real_escape_string($_POST['carrfloor'])."', '".$db->real_escape_string($_POST['pay'])."', '".$db->real_escape_string($_POST['comms'])."' )"; $insert = $db->query($sql); echo "<font color='red'>Carrier Inserted</font>"; } } ?> <h1>Add New</h1> <hr> <form method="post" action=""> Carrier<br /> <input name="reg" type="text" required="required" value=""> <br /><br /> Number<br /> <input name="acc" type="text" required="required" value=""> <br /><br /> Status<br /> <input name="accstatus" type="text" required="required" value=""> Floor<br /> <select name="carrfloor" id="carrfloor"> <option name="carrfloor" Value="1">1</option> <option name="carrfloor" Value="2">2</option> </select> <br /><br /> Pay<br /> <select name="pay" id="pay"> <option selected="selected" name="pay" Value="0">N/A</option> <option name="pay" Value="1">1%</option> <option name="pay" Value="1.25">1.25%</option> <option name="pay" Value="1.5">1.5%</option> <option name="pay" Value="1.75">1.75%</option> <option name="pay" Value="2">2%</option> <option name="pay" Value="2.25">2.25%</option> <option name="pay" Value="2.50">2.50%</option> <option name="pay" Value="3.00">3%</option> </select> <br /><br /> Additional Charge<br /> <select name="comms" id="comms"> <option name="comms" selected ="selected" Value="Fees">Yes</option> <option name="comms" Value="No Fees">No</option> </select> <br /><br /> Manager<br /> <select name="carramid" id="carramid"> <option name="carramid" Value="Yes">Yes</option> <option name="carramid" Value="No">No</option> </select> <br /><br /> <br /><br /> <input type="submit" class="btn" name="carrierinsert" value="Save" /> </form>
$sql = "INSERT INTO cariers ( reg, acc, accstatus, carramid, carrfloor, pay, comms) VALUES ( '".{$db->real_escape_string($_POST['reg'])}."', '".{$db->real_escape_string($_POST['acc'])}."', '".{$db->real_escape_string($_POST['accstatus'])}."', '".{$db->real_escape_string($_POST['carramid'])}."', '".{$db->real_escape_string($_POST['carrfloor'])}."', '".{$db->real_escape_string($_POST['pay'])}."', '".{$db->real_escape_string($_POST['comms'])}."' )"; UPDATE $a = 15; echo 'this will not write 15: $a' .PHP_EOL. "this will write 15: $a" .PHP_EOL. "but i can escape a variable anyways. i dont need to change quotes".$a.' dot (.) is the add method for strings' ;
try this: $sql = "INSERT INTO cariers ( `reg`, `acc`, `accstatus`, `carramid`, `carrfloor`, `pay`, `comms`) VALUES ( '".$db->real_escape_string($_POST['reg'])."', '".$db->real_escape_string($_POST['acc'])."', '".$db->real_escape_string($_POST['accstatus'])."', '".$db->real_escape_string($_POST['carramid'])."', '".$db->real_escape_string($_POST['carrfloor'])."', '".$db->real_escape_string($_POST['pay'])."', '".$db->real_escape_string($_POST['comms'])."' )"; EDITTED: try this code <?php if (isset($_POST['carrierinsert'])) { $acc = $_POST['acc']; $sql = "SELECT cariers.acc FROM cariers WHERE cariers.acc ='$acc'"; $result = $db->query($sql); if($result->num_rows > 0) { echo "<font color='red'>Carrier Already exits</font>"; }else{ $sql = "INSERT INTO cariers ( `reg`, `acc`, `accstatus`, `carramid`, `carrfloor`, `pay`, `comms`) VALUES ( '".$db->real_escape_string($_POST['reg'])."', '".$db->real_escape_string($_POST['acc'])."','".$db->real_escape_string($_POST['accstatus'])."','".$db->real_escape_string($_POST['carramid'])."', '".$db->real_escape_string($_POST['carrfloor'])."','".$db->real_escape_string($_POST['pay'])."','".$db->real_escape_string($_POST['comms'])."' )"; $insert = $db->query($sql); echo "<font color='red'>Carrier Inserted</font>"; } } ?> <h1>Add New</h1> <hr> <form method="post" action=""> Carrier<br /> <input name="reg" type="text" required="required" value=""> <br /><br /> Number<br /> <input name="acc" type="text" required="required" value=""> <br /><br /> Status<br /> <input name="accstatus" type="text" required="required" value=""> Floor<br /> <select name="carrfloor" id="carrfloor"> <option value="1">1</option> <option value="2">2</option> </select> <br /><br /> Pay<br /> <select name="pay" id="pay"> <option selected="selected" value="0">N/A</option> <option value="1">1%</option> <option value="1.25">1.25%</option> <option value="1.5">1.5%</option> <option value="1.75">1.75%</option> <option value="2">2%</option> <option value="2.25">2.25%</option> <option value="2.50">2.50%</option> <option value="3.00">3%</option> </select> <br /><br /> Additional Charge<br /> <select name="comms" id="comms"> <option selected ="selected" value="Fees">Yes</option> <option value="No Fees">No</option> </select> <br /><br /> Manager<br /> <select name="carramid" id="carramid"> <option value="Yes">Yes</option> <option value="No">No</option> </select> <br /><br /> <br /><br /> <input type="submit" class="btn" name="carrierinsert" value="Save" /> </form>
display a form just in a particular case using control structure
I'm a beginner in PHP, I am working on a carpooling website and I want to display a form in the user account only if he didn't enter his car yet here is my code and unfortunately it didn't work and I haven't got any error on my screen. Please help me if you can !! <div id="edit-settings" class="tab-pane"> <?php $user_id=$_SESSION['user']['id']; $res = $db->query('SELECT COUNT(*) FROM car where $user_id'); $get_total = $res->fetchColumn(); if($get_total==0){ echo 'please enter a car by filling the form below'; ?> <form action="car.php" method="post"> <br /> <label class="control-label" for="inputEmail"> Brand * </label> <input class="span4" type="text" placeholder="Brand *" name="brand" maxlength="64" required=""> <br /> <br /> <label class="control-label" for="inputEmail"> Model * </label> <input class="span4" type="text" placeholder="Model *" name="model" maxlength="64" required=""> <br /><br /> <label class="control-label" for="inputEmail"> Confort * </label> <select id="lst_confort" class="span4" name="confort"> <option value="Basique">Basic</option> <option value="Normal">Normal</option> <option value="Confortable">Confortable</option> <option value="Luxe">Luxary</option> </select> <br /><br /> <label class="control-label" for="inputEmail"> Color * </label> <select id="lst_confort" class="span4" name="couleur"> <option value="0" selected> choose a color</option> <option value="0"> white</option> <option value="1">black</option> <option value="2">blue</option> <option value="3"> Red</option> <option value="4"> Orange </option> <option value="5"> Green</option> <option value="6"> Yellow </option> </select> <br /><br /> <label class="control-label" for="inputEmail"> Nb places * </label> <select name="places" id="lst_NbPlaces" class="span2" required=""> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> </select> <br /> <br /> <button type="submit" class="btn btn-success"> Submit</button> <br /> <br /> <br /> <label class="text-info"> * required field </label> </form> <?php } else { echo "You have already entered car !"; } ?>
Your query is wrong: SELECT COUNT(*) FROM car where $user_id This is in single quotes, so it is interpreted as exactly what you see above; $user_id is seen as literal text, not a variable. That is not a valid query. I suspect you mean something like $res = $db->query('SELECT COUNT(*) FROM car where user_id = ' . $user_id); (Change user_id to match your column name as needed.) Note that this is extremely vulnerable to SQL injection and is therefore entirely unsafe for real-world use. Also, in the future, you can try checking the database errors and logs to determine what went wrong.
Your query has a syntax error: $res = $db->query('SELECT COUNT(*) FROM car where $user_id'); ^--- You have no comparison, so in effect you're doing SELECT COUNT(*) ... WHERE true and are counting ALL records in the table. As soon as you had one user enter a car, ALL users were treated as having cars. Perhaps you want something more like $res = $db->query('SELECT COUNT(*) FROM car where user = $user_id'); ^^^^^^^
Error towards the end of my php code and I can't locate it and i've been trying for two days [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 8 years ago. Improve this question Link to basic functions file: <?php require_once("functions.inc"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <link rel="stylesheet" type="type/css" href="form.css"/> <title>Registration Page</title> </head> <body> <form id="userForm" method="POST" action="register-process.php"> <div> Registration Page: <fieldset> <legend>Registration Information</legend> <div id="errorDiv"> <?php if (isset($_SESSION['error']) && isset($_SESSION['formAttempt'])) { unset($_SESSION['formAttempt']); print "Errors encountered<br />\n"; foreach ($_SESSION['error'] as $error) { print $error . "<br />\n"; } //end foreach ?> </div> Registration Page Fields: <label for="fname">First Name:* </label> <input type="text" id="fname" name="fname" /> <span class="errorFeedback errorSpan" id="fnameError"> First Name is required</span> <br /> <label for="lname">Last Name:* </label> <input type="text" id="lname" name="lname"> <span class="errorFeedback errorSpan" id="lnameError">Last Name is required</span> <br /> <label for="email">E-mail Address:*</label> <input type="text" id="email" name="email"> <span class="errorFeedback errorSpan" id="emailError">E-mail is required</span> <br /> <label for="password1">Password:*</label> <input type="password" id="password1" name="password1"> <span class="errorFeedback errorSpan" id="password1Error">Password required</span> <br /> <label for="password2">Verify Password:*</label> <input type="password" id="password2" name="password2"> <span class="errorFeedback errorSpan" id="password1Error">Password required</span> <br /> <label for="addr">Address: </label> <input type="text" id="addr" name="addr"> <br /> <label for="city">City:</label> <input type="text" id="city" name="city"> <br /> <label for="county">County:</label> <select name="county" id="county"> <option></option> <option value="Avon">Avon</option> <option value="Bedfordshire">Bedfordshire</option> <option value="Berkshire">Berkshire</option> <option value="Borders">Borders</option> <option value="Buckinghamshire">Buckinghamshire</option> <option value="Cambridgeshire">Cambridgeshire</option> <option value="Central">Central</option> <option value="Cheshire">Cheshire</option> <option value="Cleveland">Cleveland</option> <option value="Clwyd">Clwyd</option> <option value="Cornwall">Cornwall</option> <option value="County Antrim">County Antrim</option> <option value="County Armagh">County Armagh</option> <option value="County Down">County Down</option> <option value="County Fermanagh">County Fermanagh</option> <option value="County Londonderry">County Londonderry</option> <option value="County Tyrone">County Tyrone</option> <option value="Cumbria">Cumbria</option> <option value="Derbyshire">Derbyshire</option> <option value="Devon">Devon</option> <option value="Dorset">Dorset</option> <option value="Dumfries and Galloway">Dumfries and Galloway</option> <option value="Durham">Durham</option> <option value="Dyfed">Dyfed</option> <option value="East Sussex">East Sussex</option> <option value="Essex">Essex</option> <option value="Fife">Fife</option> <option value="Gloucestershire">Gloucestershire</option> <option value="Grampian">Grampaign</option> <option value="Greater Manchester">Greater Manchester</option> <option value="Gwent">Gwent</option> <option value="Gwynedd County">Gwynedd County</option> <option value="Hampshire">Hampshire</option> <option value="Herefordshire">Herefordshire</option> <option value="Hertfordshire">Hertfordshire</option> <option value="Highlands and Islands">Highlands and Islands</option> <option value="Humberside">Humberside</option> <option value="Isle of Wight">Isle of Wight</option> <option value="Kent">Kent</option> <option value="Lancashire">Lancashire</option> <option value="Leicestershire">Leicestershire</option> <option value="Lincolnshire">Licolnshire</option> <option value="Lothian">lothian</option> <option value="Merseyside">Merseyside</option> <option value="Mid Glamorgan">Mid Glamorgan</option> <option value="Norfolk">Norfolk</option> <option value="North Yorkshire">North Yorkshire</option> <option value="Northamptonshire">Northhamptonshire</option> <option value="Northumberland">Northumberland</option> <option value="Nottinghamshire">Nottinghamshire</option> <option value="Oxfordshire">Oxforshire</option> <option value="Powys">Powys</option> <option value="Rutland">Rutland</option> <option value="Shropshire">Shropshire</option> <option value="Somerset">Somerset</option> <option value="South Glamorgan">South Glamorgan</option> <option value="South Yorkshire">South Yorkshire</option> <option value="Staffordshire">Staffordshire</option> <option value="Strathclyde">Strathclyde</option> <option value="Suffolk">Suffolk</option> <option value="Surrey">Surrey</option> <option value="Teesside">Teesside</option> <option value="Tyne and Wear">Tyne and Wear</option> <option value="Warwickshire">Warwickshire</option> <option value="West Glamorgan">West Glamorgan</option> <option value="West Midlands">West Midlands</option> <option value="West Sussex">West Sussex</option> <option value="West Yorkshire">West Yorkshire</option> <option value="Wiltshire">Wiltshire</option> <option value="Worcestershire">Worcestershire</option> </select> <br /> <label for="postcode">Postcode:</label> <input type="text" id="postcode" name="postcode"> <br /> <label for="phone">Phone Number:</label> <input type="text" id="phone" name="phone"> <span class="errorFeedback errorSpan" id="phoneError">Format: xxxx-xxx-xxxx</span> <br /> <br /> <label for="mobile"> Number Type:</label> <input class="radioButton" type="radio" name="phonetype" id="mobile" value="mobile"> <label class="radioButton" for="mobile">Mobile</label> <input class="radioButton" type="radio" name="phonetype" id="home" value="home"> <label class="radioButton" for="home">Home</label> Syntax error is apparently on this line according to Dreamweaver and the error was present from early on when writing the code and moved to the to the newer span class when a new one was added: <span class="errorFeedback errorSpan phoneTypeError" id="phonetypeError">Please choose an option</span> <br /> <input type="submit" id="submit" name="submit"> </fieldset> </div> </form> </body> When I attempt to view this page in a web browsers it suggests that there are issues with the last line: </html> I have looked for errors but came seem to find any clear ones! Hope I'm not being stupid
You are using this twice <span class="errorFeedback errorSpan" id="password1Error">Password required</span> Remove one instance of that.... Secondly , you forgot to close a brace for your if. Close it like this <?php if (isset($_SESSION['error']) && isset($_SESSION['formAttempt'])) { unset($_SESSION['formAttempt']); print "Errors encountered<br />\n"; foreach ($_SESSION['error'] as $error) { print $error . "<br />\n"; } //end foreach }//<----- Add here ?>
add last brackets in your php code. because you use if statement and foreach.. <?php if() { //enter code here foreach() { //enter code here } } ?>
You're missing the closing bracket of your IF statement: <?php if (isset($_SESSION['error']) && isset($_SESSION['formAttempt'])) { unset($_SESSION['formAttempt']); print "Errors encountered<br />\n"; foreach ($_SESSION['error'] as $error) { print $error . "<br />\n"; } //end foreach } // <-- MISSING ?>
PHP form to email
I have created a form on our website for an online submission of claims for our work. I have two pages associated with the form. I have a back end .php page with a thank you for submission and the code to POST an e-mail to our business address. When the form is filled out, and then submitted, we are not recieving an e-mail. I am pretty new to coding and this is my first attempt at creating a form. I thought I had the necessary code and .php to do this. I would really appreciate any input on how to make this form come through in an e-mail. My form page appears as such: -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <!-- InstanceBegin template="Templates/main_page.dwt" codeOutsideHTMLIsLocked="false" --> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <!-- InstanceBeginEditable name="doctitle" --> <title>Assignment Submission</title> <!--[if lte IE 9]> <style type="text/css" title="ie-style-css"> /* lte IE 9 style*/ </style> <![endif]--> <!-- InstanceEndEditable --> <link href="stylesheets/reset.css" rel="stylesheet" type="text/css" /> <link href="stylesheets/index.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="scripts/browser-compatibility.js"></script> <!-- InstanceBeginEditable name="head" --> <!-- InstanceEndEditable --> <script type="text/javascript" src="http://cdn.wibiya.com/Toolbars/dir_1424/Toolbar_1424727/Loader_1424727.js"></script> </head> <body> <noscript> Web Toolbar by Wibiya </noscript> <div class="main_wrapper cf"> <div class="header cf"> <div class="logo_holder cf"></div> <div class="nav_holder cf"> <ul class="hmenubar cf"> <li>Home </li> <li>About </li> <li>Services </li> <li>coverage </li> <li>submit an assignment </li> <li>Resources </li> <li>Contact </li> <script type="text/javascript" src="scripts/menu_selection.js"></script> </ul> </div> </div> <div class="content cf"> <!-- InstanceBeginEditable name="ContentRegion" --> <div class="column_1"> <h2 class="about">Assignment Submission Form</h2> <h2 class="service_text"><font color="#FF0000">PLEASE BE AWARE WE ARE EXPERIENCING DIFFICULTIES WITH OUR ONLINE SUBMISSION FORM. PLEASE CONTACT US TO PROVIDE US WITH AN ASSIGNMENT AT THIS TIME. (xxx) xxx-xxxx. Thank you.</font><br /> Please complete as many fields as possible and click submit at the bottom of the page. We will contact you with a confirmation. If you do not hear from us within 2 hours of submission, please contact us. </h2> <form id="new_assignment" name="Assignment Form" method="post" action="result.php" class="assign_form"> <hr /> <h1 class="revtitle" style="color: rgb(157, 72, 61); text-align: left;">Client Information</h1> <hr /> <p class="paragraph2"> <label>Company Name:</label> <input name="company" type="text" required="required" form="new_assignment" tabindex="1" style="width:225px" /> <br/> <label>Adjuster:</label> <input name="adj" type="text" required="required" form="new_assignment" tabindex="2" style="width:200px" /> <label>E-mail:</label> <input name="email" type="email" required="required" form="new_assignment" tabindex="3" style="width:250px" /> <br/> <label>Phone Number:</label> <input name="adj_phone_number" type="tel" required="required" form="new_assignment" tabindex="4" style="width:100px" /> <label>Extension:</label> <input name="ext" type="text" form="new_assignment" tabindex="5" style="width:40px" /> <label>Fax Number:</label> <input name="fax" type="tel" form="new_assignment" tabindex="6" style="width:100px" /> </p> <hr /> <div class="claim_info"> <h1 class="revtitle" style="color: rgb(157, 72, 61); text-align: left;">Claim Information</h1> <hr /> <p class="paragraph2"> <label>Assignment Type:</label> <select name="assign_type" form="new_assignment" tabindex="7" title="Assignment Type"> <option value="auto" selected="selected">Automobile</option> <option value="rec">Recreational</option> <option value="heavy">Heavy Equipment</option> <option value="property">Minor Property</option> <option value="audit">Estimate Audit</option> <option value="scene_invest">Scene Investigation</option> <option value="arb">Arbitration</option> <option value="DRP">DRP Quality Control Inspection</option> <option value="photos">Photos Only</option> </select> <label>Type of Loss:</label> <select name="loss_type" form="new_assignment" tabindex="8" title="Loss Type"> <option value="coll">Collision</option> <option value="comp">Comprehensive</option> <option value="other">Other</option> </select> <br/> <label>Claim #:</label> <input name="claim_#" type="text" required="required" form="new_assignment" tabindex="9" style="width:225px" /> <label>Policy #:</label> <input name="policy_#" type="text" form="new_assignment" tabindex="10" style="width:150px" /> <br/> <label>Deductible: </label> <input name="deductible" type="text" form="new_assignment" tabindex="11" style="width:100px" /> <label>Date of Loss: </label> <input name="dol" type="date" form="new_assignment" tabindex="12" style="width:150px" /> <br /> </p> <div class="insd_info"> <label>Insured:</label> <input name="insured" type="text" required="required" form="new_assignment" tabindex="13" style="width:200px" /> <br/> <label>Address:</label> <input name="insd_address" type="text" form="new_assignment" tabindex="14" style="width:275px" /> <br/> <label>City:</label> <input name="insd_city" type="text" form="new_assignment" tabindex="15" style="width:120px" /> <label>State:</label> <select name="insd_state" form="new_assignment" tabindex="16" title="Insured State"> <option value="AL">AL</option> <option value="AK">AK</option> <option value="AZ">AZ</option> <option value="AR">AR</option> <option value="CA">CA</option> <option value="CO">CO</option> <option value="CT">CT</option> <option value="DE">DE</option> <option value="FL">FL</option> <option value="GA">GA</option> <option value="HI">HI</option> <option value="ID">ID</option> <option value="IL">IL</option> <option value="IN">IN</option> <option value="IA">IA</option> <option value="KS">KS</option> <option value="KY">KY</option> <option value="LA">LA</option> <option value="ME">ME</option> <option value="MD">MD</option> <option value="MA">MA</option> <option value="MI" selected="selected">MI</option> <option value="MN">MN</option> <option value="MS">MS</option> <option value="MO">MO</option> <option value="MT">MT</option> <option value="NE">NE</option> <option value="NV">NV</option> <option value="NH">NH</option> <option value="NJ">NJ</option> <option value="NM">NM</option> <option value="NY">NY</option> <option value="NC">NC</option> <option value="ND">ND</option> <option value="OH">OH</option> <option value="OK">OK</option> <option value="OR">OR</option> <option value="PA">PA</option> <option value="RI">RI</option> <option value="SC">SC</option> <option value="SD">SD</option> <option value="TN">TN</option> <option value="TX">TX</option> <option value="UT">UT</option> <option value="VT">VT</option> <option value="VA">VA</option> <option value="WA">WA</option> <option value="WV">WV</option> <option value="WI">WI</option> <option value="WY">WY</option> </select> <br/> <label>Zip Code:</label> <input name="insd_ZIP" type="text" form="new_assignment" tabindex="17" style="width:130px" /> <br/> <label>Home Phone:</label> <input name="insd_home" type="tel" form="new_assignment" tabindex="18" style="width:140px" /> <br/> <label>Work Phone:</label> <input name="insd_work" type="tel" form="new_assignment" tabindex="19" style="width:140px" /> <br/> <label>Mobile Phone:</label> <input name="insd_mobile" type="tel" form="new_assignment" tabindex="20" style="width:140px" /> <br/> <label>Other Phone:</label> <input name="insd_other" type="tel" form="new_assignment" tabindex="21" style="width:140px " /> <br/> </div> <div class="claimant_info "> <label>Claimant:</label> <input name="claimant " type="text " required="required " form="new_assignment " tabindex="22" style="width:200px " /> <br/> <label>Address:</label> <input name="claimant_address " type="text " form="new_assignment " tabindex="23" style="width:275px " /> <br/> <label>City:</label> <input name="claimant_city " type="text " form="new_assignment " tabindex="24" style="width:120px " /> <label>State:</label> <select name="claimant_state " form="new_assignment " tabindex="25" title="Claimant State "> <option value="AL ">AL</option> <option value="AK ">AK</option> <option value="AZ ">AZ</option> <option value="AR ">AR</option> <option value="CA ">CA</option> <option value="CO ">CO</option> <option value="CT ">CT</option> <option value="DE ">DE</option> <option value="FL ">FL</option> <option value="GA ">GA</option> <option value="HI ">HI</option> <option value="ID ">ID</option> <option value="IL ">IL</option> <option value="IN ">IN</option> <option value="IA ">IA</option> <option value="KS ">KS</option> <option value="KY ">KY</option> <option value="LA ">LA</option> <option value="ME ">ME</option> <option value="MD ">MD</option> <option value="MA ">MA</option> <option value="MI " selected="selected">MI</option> <option value="MN ">MN</option> <option value="MS ">MS</option> <option value="MO ">MO</option> <option value="MT ">MT</option> <option value="NE ">NE</option> <option value="NV ">NV</option> <option value="NH ">NH</option> <option value="NJ ">NJ</option> <option value="NM ">NM</option> <option value="NY ">NY</option> <option value="NC ">NC</option> <option value="ND ">ND</option> <option value="OH ">OH</option> <option value="OK ">OK</option> <option value="OR ">OR</option> <option value="PA ">PA</option> <option value="RI ">RI</option> <option value="SC ">SC</option> <option value="SD ">SD</option> <option value="TN ">TN</option> <option value="TX ">TX</option> <option value="UT ">UT</option> <option value="VT ">VT</option> <option value="VA ">VA</option> <option value="WA ">WA</option> <option value="WV ">WV</option> <option value="WI ">WI</option> <option value="WY ">WY</option> </select> <br/> <label>Zip Code:</label> <input name="claimant_ZIP " type="text " form="new_assignment " tabindex="26" style="width:130px " /> <br/> <label>Home Phone:</label> <input name="claimant_home " type="tel " form="new_assignment " tabindex="27" style="width:140px " /> <br/> <label>Work Phone:</label> <input name="claimant_work " type="tel " form="new_assignment " tabindex="28" style="width:140px " /> <br/> <label>Mobile Phone:</label> <input name="claimant_mobile " type="tel " form="new_assignment " tabindex="29" style="width:140px " /> <br/> <label>Other Phone:</label> <input name="claimant_other" type="tel" form="new_assignment" tabindex="30" style="width:140px" /> </div> </div> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br /> <hr /> <h1 class="revtitle" style="color: rgb(157, 72, 61); text-align: left;">Vehicle Information</h1> <hr /> <p class="paragraph2"> <label>Owner of vehicle to be inspected: </label> <select name="owner_type" form="new_assingments" tabindex="31" style="width:160px"> <option value="insd" selected="selected">Insured</option> <option value="clmt">Claimant</option> </select> <br /> <label>Year: </label> <input name="veh_year" type="text" for="new_assignment" tabindex="32" style="width:80px" /> <label>Make: </label> <input name="veh_make" type="text" form="new_assignment" tabindex="33" style="width:100px" /> <label>Model: </label> <input name="veh_model" type="text" form "new_assigment" tabindex="34" style="width:100px" /> <label>Color: </label> <input name="veh_color" type="text" form="new_assignment" tabindex="35" style="width:100px" /> <br/> <label>VIN: </label> <input name="veh_VIN" type="text" form="new_assignment" tabindex="36" style="width:200px" /> <label>License Plate: </label> <input name="lic_plate" type="text" form="new_assignment" tabindex="37" style="width:100px" /> <label>State:</label> <select name="license_state " form="new_assignment " tabindex="38" title="License State "> <option value="AL ">AL</option> <option value="AK ">AK</option> <option value="AZ ">AZ</option> <option value="AR ">AR</option> <option value="CA ">CA</option> <option value="CO ">CO</option> <option value="CT ">CT</option> <option value="DE ">DE</option> <option value="FL ">FL</option> <option value="GA ">GA</option> <option value="HI ">HI</option> <option value="ID ">ID</option> <option value="IL ">IL</option> <option value="IN ">IN</option> <option value="IA ">IA</option> <option value="KS ">KS</option> <option value="KY ">KY</option> <option value="LA ">LA</option> <option value="ME ">ME</option> <option value="MD ">MD</option> <option value="MA ">MA</option> <option value="MI ">MI</option> <option value="MN ">MN</option> <option value="MS ">MS</option> <option value="MO ">MO</option> <option value="MT ">MT</option> <option value="NE ">NE</option> <option value="NV ">NV</option> <option value="NH ">NH</option> <option value="NJ ">NJ</option> <option value="NM ">NM</option> <option value="NY ">NY</option> <option value="NC ">NC</option> <option value="ND ">ND</option> <option value="OH ">OH</option> <option value="OK ">OK</option> <option value="OR ">OR</option> <option value="PA ">PA</option> <option value="RI ">RI</option> <option value="SC ">SC</option> <option value="SD ">SD</option> <option value="TN ">TN</option> <option value="TX ">TX</option> <option value="UT ">UT</option> <option value="VT ">VT</option> <option value="VA ">VA</option> <option value="WA ">WA</option> <option value="WV ">WV</option> <option value="WI ">WI</option> <option value="WY ">WY</option> </select> <br/> <label>Description of Loss: </label> <textarea name="desc_of_loss" id="desc_of_loss" form="new_assignment" tabindex="39" style="width:500px"></textarea> <br /> <label>Description of Damage: </label> <textarea name="desc_of_dmg" id="desc_of_dmg" form="new_assignment" tabindex="40" style="width:500px"></textarea> <br /> </p> <hr /> <h1 class="revtitle" style="color: rgb(157, 72, 61); text-align: left;">Vehicle Location</h1> <hr /> <p class="paragraph2"> <label>Location Name: </label> <input name="location_name" type="text" form="new_assignment" style="width:250px" tabindex="41" value="With Owner" /> <br /> <label>Address: </label> <input name="location_address" type="text" form="new_assignment" style="width:300px" tabindex="42" value="(same as owner above)" /> <br /> <label>City:</label> <input name="insd_city" type="text" form="new_assignment" tabindex="43" style="width:120px" /> <label>State:</label> <select name="insd_state" form="new_assignment" tabindex="44" title="Insured State"> <option value="AL">AL</option> <option value="AK">AK</option> <option value="AZ">AZ</option> <option value="AR">AR</option> <option value="CA">CA</option> <option value="CO">CO</option> <option value="CT">CT</option> <option value="DE">DE</option> <option value="FL">FL</option> <option value="GA">GA</option> <option value="HI">HI</option> <option value="ID">ID</option> <option value="IL">IL</option> <option value="IN">IN</option> <option value="IA">IA</option> <option value="KS">KS</option> <option value="KY">KY</option> <option value="LA">LA</option> <option value="ME">ME</option> <option value="MD">MD</option> <option value="MA">MA</option> <option value="MI" selected="selected">MI</option> <option value="MN">MN</option> <option value="MS">MS</option> <option value="MO">MO</option> <option value="MT">MT</option> <option value="NE">NE</option> <option value="NV">NV</option> <option value="NH">NH</option> <option value="NJ">NJ</option> <option value="NM">NM</option> <option value="NY">NY</option> <option value="NC">NC</option> <option value="ND">ND</option> <option value="OH">OH</option> <option value="OK">OK</option> <option value="OR">OR</option> <option value="PA">PA</option> <option value="RI">RI</option> <option value="SC">SC</option> <option value="SD">SD</option> <option value="TN">TN</option> <option value="TX">TX</option> <option value="UT">UT</option> <option value="VT">VT</option> <option value="VA">VA</option> <option value="WA">WA</option> <option value="WV">WV</option> <option value="WI">WI</option> <option value="WY">WY</option> </select> <br/> <label>Zip Code: </label> <input name="insd_ZIP" type="text" form="new_assignment" tabindex="45" style="width:130px" /> <label>Contact: </label> <input name="location_contact" type="text" form="new_assignment" tabindex="46" style="width:150px" /> <br/> </p> <hr /> <input type="reset" class="button" /> <input name="submit" type="submit" class="button" form="new_assignment" formaction="/result.php" formenctype="multipart/form-data" formmethod="POST" value="Submit" /> <p></p> <div class="important" id="important"> <label>Trojan</label> <input type="text" name="trojan" id="trojan" /> </div> </form> </div> <!-- InstanceEndEditable --> </div> <div class="footer cf"> <p class="rights">LMC Insurance Services, INC - 2013 All Rights Reserved | <a class="privacy" href="/privacy_policy.html" target="_self">Privacy Policy</a> </p> </div> </div> </body> <!-- InstanceEnd --> </html> And my .php results page appears as: <!doctype html> <html> <head> <meta charset="UTF-8"> <title>Submission</title> </head> <body> <?PHP //checks if bot if($_POST['trojan']!=''); die("Changed field"); $adj = $_POST['adj']; $company = $_POST['company']; $email = $_POST['email']; $adj_phone = $_POST['adj_phone_number']; $ext = $_POST['ext']; //Sending Email to form owner $header = "From: $email\n" . "Relpy-To: $email\n"; $subject = "New Assignment from Website"; $email_to = "office#example.com"; $message = "We recieved a new assignment from $adj \n" . "They can be reached at $adj_phone $ext \n" . "Their e-mail address is $email \n"; mail($email_to,$subject,$message,$header); ?> <h1>Thank you for your submission!</h1> <p>Your information has been sent, and our office will contact you to verify the assignment and confirm any special instructions.</p> <p>We thank you for utilizing our services. We hope to complete your assignment in a timely manner.</p> </body> </html> Any and all help is greatly appreciated.
remove the ; from if($_POST['trojan']!=''); ^ here because I think this following statement is executed every time as that semicolon make the following line independent of that if statement die("Changed field");
I haven't checked the code in detail, but the most likely problem is that the server is not set up to send mail. Check a) php settings for mail (you can do this by running phpinfo(); but usually these are set up correctly out of the box. b) Check server mail application is installed and configured, eg Exim, Sendmail, etc. Setting up a server to send (but not receive) mail is fairly easy. Eg on a Debian server you would run something like sudo apt-get install exim4 And then follow instructions to configure it to send mail.
A few things to check: Is your mail server properly configured? Can you send test email successfully? Do you have any other control in place to test whether the infrastructure overall works, rather than just the one script that is not currently working? Also consider using a library such as PHPMailer (http://phpmailer.worxware.com/). It offers much more flexibility when it comes to configuring your mail server.
At your if statement: if($_POST['trojan'] != ''); die("Changed field"); Should be: if($_POST['trojan'] != ''){ die("Changed field"); }