bebelushu Posted June 24, 2009 Share Posted June 24, 2009 Hello, I just started learning PHP a month ago and trying to make a registration form. I have this problem with a registration form and I hope you guys can help. The code is quite long so i'm not sure if i should post it here, but if you go Here you can see what i'm talking about. What I'm trying to do is: After a person completes the form and press "Submit" i would like have only a message on the page: " Thank you for registering with us" and i don't know how to make the code so the form won't appear with the message. <?php if (isset($_POST['submit'])) { $title = $_POST['title']; $name = $_POST['name']; $surname = $_POST['surname']; .... $address = $_POST['address']; $postcode = $_POST['postcode']; $output_form = false; if (empty($name)) { echo '<b style="font-weight:bold;color:red"> Please type in your name.</b><br />'; $output_form = true; } ......if (empty($agree)) { echo '<b style="font-weight:bold;color:red">Please tick the "I agree" box at the bottom of the form.</b><br />'; $output_form = true; } else { $output_form = true; $dbc = mysqli_connect('', '', '', '') or die('Error connecting to MySQL server.'); $query = "INSERT INTO table (title, name, surname, address, phone, mobile, email, mocupation, focupation,". "mnationality, fnationality, freligion, practiceit, language, childna, disabledm, disabledma, babye, singlep,". "pets, anyhelp, vegetarian, smoke, interests, share, reference, aupair, natpreference, natspecification, englishlevel,". "aupairgender, driver, car, smoker, vegaupair, duration, weekhrs, money, engcourses, choirs, start, hadaupair,". "comments, homespec, aupairroom, amenities, agree) " . "VALUES ('$title', '$name', '$surname', '$address', '$phone', '$mobile', '$email', '$mocupation', '$focupation',". "'$mnationality', '$fnationality', '$freligion', '$practiceit', '$language', '$childna', '$disabledm', '$disabledma', '$babye', '$singlep',". "'$pets', '$anyhelp', '$vegetarian', '$smoke', '$interests', '$share', '$reference', '$aupair', '$natpreference', '$natspecification', '$englishlevel',". "'$aupairgender', '$driver', '$car', '$smoker', '$vegaupair', '$duration', '$weekhrs', '$money', '$engcourses', '$choirs', '$start', '$hadaupair',". "'$comments', '$homespec', '$aupairroom', '$amenities', '$agree')"; $result = mysqli_query($dbc, $query) or die('Error querying database.'); mysqli_close($dbc); } } if (!empty($name) && !empty($surname) && !empty($address) && !empty($phone) && !empty($email) && !empty($mocupation) && !empty($focupation) && !empty($mnationality) && !empty($fnationality) && !empty($freligion) && !empty($language) && !empty($childna) && !empty($reference) && !empty($duration) && !empty($weekhrs) && !empty($money) && !empty($start) && !empty($homespec) && !empty($aupairroom) && !empty($amenities) && !empty($agree)){ echo '<p id="thanks">Thank you for registering with us!</p>'; } ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <p id="form">Family registration form</p><br /> <table id="first"> <tr> <td><label for="title"> Title:</label></td> ...... If anyone can help i would be grateful . I can post the entire code here if the above is not enough. Many thanks Val Quote Link to comment https://forums.phpfreaks.com/topic/163530-please-help-with-php/ Share on other sites More sharing options...
J.Daniels Posted June 24, 2009 Share Posted June 24, 2009 Try something like this: <?php if (isset($_POST['submit'])) { $title = $_POST['title']; $name = $_POST['name']; $surname = $_POST['surname']; .... $address = $_POST['address']; $postcode = $_POST['postcode']; $output_form = false; if (empty($name)) { echo '<b style="font-weight:bold;color:red"> Please type in your name.</b><br />'; $output_form = true; } ......if (empty($agree)) { echo '<b style="font-weight:bold;color:red">Please tick the "I agree" box at the bottom of the form.</b><br />'; $output_form = true; } else { $output_form = true; $dbc = mysqli_connect('', '', '', '') or die('Error connecting to MySQL server.'); $query = "INSERT INTO table (title, name, surname, address, phone, mobile, email, mocupation, focupation,". "mnationality, fnationality, freligion, practiceit, language, childna, disabledm, disabledma, babye, singlep,". "pets, anyhelp, vegetarian, smoke, interests, share, reference, aupair, natpreference, natspecification, englishlevel,". "aupairgender, driver, car, smoker, vegaupair, duration, weekhrs, money, engcourses, choirs, start, hadaupair,". "comments, homespec, aupairroom, amenities, agree) " . "VALUES ('$title', '$name', '$surname', '$address', '$phone', '$mobile', '$email', '$mocupation', '$focupation',". "'$mnationality', '$fnationality', '$freligion', '$practiceit', '$language', '$childna', '$disabledm', '$disabledma', '$babye', '$singlep',". "'$pets', '$anyhelp', '$vegetarian', '$smoke', '$interests', '$share', '$reference', '$aupair', '$natpreference', '$natspecification', '$englishlevel',". "'$aupairgender', '$driver', '$car', '$smoker', '$vegaupair', '$duration', '$weekhrs', '$money', '$engcourses', '$choirs', '$start', '$hadaupair',". "'$comments', '$homespec', '$aupairroom', '$amenities', '$agree')"; $result = mysqli_query($dbc, $query) or die('Error querying database.'); mysqli_close($dbc); } } else { ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <p id="form">Family registration form</p><br /> <table id="first"> <tr> <td><label for="title"> Title:</label></td> ...... <?php } if (!empty($name) && !empty($surname) && !empty($address) && !empty($phone) && !empty($email) && !empty($mocupation) && !empty($focupation) && !empty($mnationality) && !empty($fnationality) && !empty($freligion) && !empty($language) && !empty($childna) && !empty($reference) && !empty($duration) && !empty($weekhrs) && !empty($money) && !empty($start) && !empty($homespec) && !empty($aupairroom) && !empty($amenities) && !empty($agree)){ echo '<p id="thanks">Thank you for registering with us!</p>'; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/163530-please-help-with-php/#findComment-862872 Share on other sites More sharing options...
bebelushu Posted June 24, 2009 Author Share Posted June 24, 2009 Thank you for the reply, unfortunately i didn't managed to make it work . Do you have any other ideas? Should i post the entire code? would that help? Thanks, Val Quote Link to comment https://forums.phpfreaks.com/topic/163530-please-help-with-php/#findComment-862930 Share on other sites More sharing options...
ldougherty Posted June 24, 2009 Share Posted June 24, 2009 The reason you see the form regardless is because the page posts to itself and the form displays regardless of anything. If you don't want it to display at the end of this if statement if (isset($_POST['submit'])) { you should add and } else { instead of just closing it with } and then add } after the end of the form. If you can't figure out what I mean then post your entire code. Quote Link to comment https://forums.phpfreaks.com/topic/163530-please-help-with-php/#findComment-862935 Share on other sites More sharing options...
bebelushu Posted June 24, 2009 Author Share Posted June 24, 2009 Thanks for the reply. It would be great if you can help me with this. <!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"> <head> <title>Aupairs</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link href="style1.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="div-wrapper"> <!--body part start --> <div id="mainbody"> <!--left part srart --> <!--left part emd --> <!--right part start --> <div id="rightpart"> <a href="html/index.html"></a> <h1>Au Pairs</h1> <h2 class="slogan">It's never been Easier </h2> <h2 class="welcom"><span>Welcome</span> to The Au Pairs Simple Agency </h2> <p id="about">The Au Pairs Simple Agency is based in Sussex and it started providing au pairs to families in 2009 after realizing that the market needed a reliable, serious, trustworthy agency to provide au pairs while offering value for money.<br /> We have the most competitive prices on the market and we are working to provide professional services while maintaining high standards of service.</p> <fieldset> <?php if (isset($_POST['submit'])) { $title = $_POST['title']; $name = $_POST['name']; $surname = $_POST['surname']; $address = $_POST['address']; $postcode = $_POST['postcode']; $phone = $_POST['phone']; $mobile = $_POST['mobile']; $email = $_POST['email']; $mocupation = $_POST['mocupation']; $focupation = $_POST['focupation']; $mnationality = $_POST['mnationality']; $fnationality = $_POST['fnationality']; $practiceit = $_POST['practiceit']; $freligion = $_POST['freligion']; $language = $_POST['language']; $childna = $_POST['childna']; $disabledm = $_POST['disabledm']; $disabledma = $_POST['disabledma']; $babye = $_POST['babye']; $singlep = $_POST['singlep']; $pets = $_POST['pets']; $anyhelp = $_POST['anyhelp']; $vegetarian = $_POST['vegetarian']; $smoke = $_POST['smoke']; $interests = $_POST['interests']; $share = $_POST['share']; $reference = $_POST['reference']; $aupair = $_POST['aupair']; $natpreference = $_POST['natpreference']; $natspecification = $_POST['natspecification']; $englishlevel = $_POST['englishlevel']; $aupairgender = $_POST['aupairgender']; $driver = $_POST['driver']; $car = $_POST['car']; $smoker = $_POST['smoker']; $vegaupair = $_POST['vegaupair']; $duration = $_POST['duration']; $weekhrs = $_POST['weekhrs']; $money = $_POST['money']; $engcourses = $_POST['engcourses']; $choirs = $_POST['choirs']; $start = $_POST['start']; $hadaupair = $_POST['hadaupair']; $comments = $_POST['comments']; $homespec = $_POST['homespec']; $aupairroom = $_POST['aupairroom']; $amenities = $_POST['amenities']; $agree = $_POST['agree']; $output_form = false; if (empty($name)) { echo '<b style="font-weight:bold;color:red"> Please type in your name.</b><br />'; $output_form = true; } if (empty($surname)) { echo '<b style="font-weight:bold;color:red">Please type in your surname.</b><br />'; $output_form = true; } if (empty($address)) { echo '<b style="font-weight:bold;color:red">Please type in your address.</b><br />'; $output_form = true; } if (empty($postcode)) { echo '<b style="font-weight:bold;color:red">Please type in your postcode.</b><br />'; $output_form = true; } if (empty($phone)) { echo '<b style="font-weight:bold;color:red">Please type in your phone number.</b><br />'; $output_form = true; } if (empty($email)) { echo '<b style="font-weight:bold;color:red">Please type in your email.</b><br />'; $output_form = true; } if (empty($mocupation)) { echo '<b style="font-weight:bold;color:red">Please type in the mother\'s occupation.</b><br />'; $output_form = true; } if (empty($focupation)) { echo '<b style="font-weight:bold;color:red">Please type in the father\'s occupation.</b><br />'; $output_form = true; } if (empty($mnationality)) { echo '<b style="font-weight:bold;color:red">Please type in the mother\'s nationality.</b><br />'; $output_form = true; } if (empty($fnationality)) { echo '<b style="font-weight:bold;color:red">Please type in the father\'s nationality.</b><br />'; $output_form = true; } if (empty($freligion)) { echo '<b style="font-weight:bold;color:red">Please type in the family religion.</b><br />'; $output_form = true; } if (empty($language)) { echo '<b style="font-weight:bold;color:red">Please type in the family language.</b><br />'; $output_form = true; } if (empty($childna)) { echo '<b style="font-weight:bold;color:red"> Please type in the children\'s names and ages.</b><br />'; $output_form = true; } if (empty($reference)) { echo '<b style="font-weight:bold;color:red">Please provide name,relationship,phone and email address of one referee.</b><br />'; $output_form = true; } if (empty($duration)) { echo '<b style="font-weight:bold;color:red">Please type in the duration of stay.</b><br />'; $output_form = true; } if (empty($weekhrs)) { echo '<b style="font-weight:bold;color:red">Please provide how many hours per week are required.</b><br />'; $output_form = true; } if (empty($money)) { echo '<b style="font-weight:bold;color:red">Please type in the poket money.</b><br />'; $output_form = true; } if (empty($start)) { echo '<b style="font-weight:bold;color:red">Please tell us when would you like the aupair to start.</b><br />'; $output_form = true; } if (empty($homespec)) { echo '<b style="font-weight:bold;color:red">Please describe your home.</b><br />'; $output_form = true; } if (empty($aupairroom)) { echo '<b style="font-weight:bold;color:red">Please describe the au pair\'s accommodation.</b><br />'; $output_form = true; } if (empty($amenities)) { echo '<b style="font-weight:bold;color:red">Please describe the area where you live.</b><br />'; $output_form = true; } if (empty($agree)) { echo '<b style="font-weight:bold;color:red">Please tick the "I agree" box at the bottom of the form.</b><br />'; $output_form = true; } else { $output_form = true; $dbc = mysqli_connect('', '', '', '') or die('Error connecting to MySQL server.'); $query = "INSERT INTO TABLE (title, name, surname, address, phone, mobile, email, mocupation, focupation,". "mnationality, fnationality, freligion, practiceit, language, childna, disabledm, disabledma, babye, singlep,". "pets, anyhelp, vegetarian, smoke, interests, share, reference, aupair, natpreference, natspecification, englishlevel,". "aupairgender, driver, car, smoker, vegaupair, duration, weekhrs, money, engcourses, choirs, start, hadaupair,". "comments, homespec, aupairroom, amenities, agree) " . "VALUES ('$title', '$name', '$surname', '$address', '$phone', '$mobile', '$email', '$mocupation', '$focupation',". "'$mnationality', '$fnationality', '$freligion', '$practiceit', '$language', '$childna', '$disabledm', '$disabledma', '$babye', '$singlep',". "'$pets', '$anyhelp', '$vegetarian', '$smoke', '$interests', '$share', '$reference', '$aupair', '$natpreference', '$natspecification', '$englishlevel',". "'$aupairgender', '$driver', '$car', '$smoker', '$vegaupair', '$duration', '$weekhrs', '$money', '$engcourses', '$choirs', '$start', '$hadaupair',". "'$comments', '$homespec', '$aupairroom', '$amenities', '$agree')"; $result = mysqli_query($dbc, $query) or die('Error querying database.'); mysqli_close($dbc); } } if (!empty($name) && !empty($surname) && !empty($address) && !empty($phone) && !empty($email) && !empty($mocupation) && !empty($focupation) && !empty($mnationality) && !empty($fnationality) && !empty($freligion) && !empty($language) && !empty($childna) && !empty($reference) && !empty($duration) && !empty($weekhrs) && !empty($money) && !empty($start) && !empty($homespec) && !empty($aupairroom) && !empty($amenities) && !empty($agree)){ echo '<p id="thanks">Thank you for registering with us!</p>'; } ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <p id="form">Family registration form</p><br /> <table id="first"> <tr> <td><label for="title"> Title:</label></td> <td><select id="title" name="title"> <option value="mr" <?php if (!empty($mr) && $title == 'mr') echo 'selected = "selected"'; ?>>Mr</option> <option value="mrs" <?php if (!empty($mrs) && $title == 'mrs') echo 'selected = "selected"'; ?>>Mrs</option> <option value="ms" <?php if (!empty($ms) && $title == 'ms') echo 'selected = "selected"'; ?>>Ms</option> </select><br /></td></tr> <tr> <td><span class="style1">*</span><label for="name">First name:</label></td> <td><input type="text" id="name" name="name" value="<?php echo $name; ?>" /> </td></tr> <tr> <td><span class="style1">*</span><label for="surname">Surname:</label></td> <td><input type="text" id="score" name="surname" value="<?php echo $surname; ?>" /> </td></tr> <tr> <td><span class="style1">*</span><label for="address">Address:</label><br /></td> <td><textarea id="address" name="address" rows="6" cols="30"><?php echo $address; ?></textarea></td></tr> <tr> <td><span class="style1">*</span><label for="postcode">Postcode:</label></td> <td><input type="text" id="postcode" name="postcode" value="<?php echo $postcode; ?>" /></td></tr> <tr> <td><span class="style1">*</span><label for="phone">Tel number:</label></td> <td><input type="text" id="score" name="phone" value="<?php echo $phone; ?>" /> </td></tr> <tr> <td><label for="mobile"> Mobile:</label></td> <td><input type="text" id="score" name="mobile" value="<?php echo $mobile; ?>" /></td></tr> <tr> <td><span class="style1">*</span><label for="email">Email:</label></td> <td><input type="text" id="email" name="email" value="<?php echo $email; ?>" /></td></tr> </table> <p id="rform">Please provide the following personal information: </p><hr /> <br /><br /> <table id="second"> <tr> <td><span class="style1">*</span><label for="mocupation">Mother’s occupation:</label></td> <td><input type="text" id="mocupation" name="mocupation" value="<?php echo $mocupation; ?>" /> </td></tr> <tr> <td><span class="style1">*</span><label for="focupation">Father’s occupation:</label></td> <td><input type="text" id="focupation" name="focupation" value="<?php echo $focupation; ?>" /> </td></tr> <tr> <td><span class="style1">*</span><label for="mnationality">Mother’s nationality:</label></td> <td><input type="text" id="mnationality" name="mnationality" value="<?php echo $mnationality; ?>" /> </td></tr> <tr> <td><span class="style1">*</span><label for="fnationality">Father’s nationality:</label></td> <td><input type="text" id="fnationality" name="fnationality" value="<?php echo $fnationality; ?>" /> </td></tr> <tr> <td><span class="style1">*</span><label for="freligion">Family’s religion:</label></td> <td><input type="text" id="freligion" name="freligion" value="<?php echo $freligion; ?>" /> </td></tr> <tr> <td> <label for="practiceit">Do you practice it:</label></td> <td><select id="practiceit" name="practiceit"> <option value="yes" <?php if (!empty($practiceit) && $practiceit == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($practiceit) && $practiceit == 'no') echo 'selected = "selected"'; ?>>No</option> </select></td></tr> <tr> <td><span class="style1">*</span><label for="language">Spoken language in family home:</label></td> <td><input type="text" id="language" name="language" value="<?php echo $language; ?>" /> </td></tr> <tr> <td><span class="style1">*</span><label for="childna">Children’s names and ages:</label></td> <td><textarea id="childna" name="childna" rows="6" cols="30"><?php echo $childna; ?></textarea></td></tr> <tr> <td><label for="disabledm">Are any of the family members disabled:</label></td> <td><select id="disabledm" name="disabledm"> <option value="yes" <?php if (!empty($disabledm) && $disabledm == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($disabledm) && $disabledm == 'no') echo 'selected = "selected"'; ?>>No</option> </select></td></tr> <tr> <td><label for="disabledma">If yes please specify:</label></td> <td><textarea id="disabledma" name="disabledma" rows="6" cols="30"><?php echo $address; ?></textarea></td></tr> <tr> <td><label for="babye">Is a baby expected?</label></td> <td><select id="babye" name="babye"> <option value="yes" <?php if (!empty($babyer) && $babye == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($babye) && $babye == 'no') echo 'selected = "selected"'; ?>>No</option> </select></td></tr> <tr> <td><label for="singlep">Are you a single parent ?</label></td> <td><select id="singlep" name="singlep"> <option value="yes" <?php if (!empty($singlep) && $singlep == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($singlep) && $singlep == 'no') echo 'selected = "selected"'; ?>>No</option> </select></td></tr> <tr> <td><label for="pets">Do you have pets? If yes please specify:</label></td> <td><textarea id="pets" name="pets" rows="6" cols="30"><?php echo $pets; ?></textarea></td></tr> <tr> <td><label for="anyhelp">Do you have any other help (gardener, cleaner, family help)? please specify:</label></td> <td><textarea id="anyhelp" name="anyhelp" rows="6" cols="30"><?php echo $anyhelp; ?></textarea></td></tr> <tr> <td><label for="vegetarian">Are you a vegetarian?</label></td> <td><select id="vegetarian" name="vegetarian"> <option value="yes" <?php if (!empty($vegetarian) && $vegetarian == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($vegetarian) && $vegetarian == 'no') echo 'selected = "selected"'; ?>>No</option> </select></td></tr> <tr> <td><label for="smoke">Do you smoke?</label></td> <td><select id="smoke" name="smoke"> <option value="yes" <?php if (!empty($smoke) && $smoke == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($smoke) && $smoke == 'no') echo 'selected = "selected"'; ?>>No</option> <option value="not_with_children" <?php if (!empty($smoke) && $smoke == 'not_with_children') echo 'selected = "selected"'; ?>>Not in the house or in front of children</option> </select></td></tr> <tr> <td><label for="interests">Family interests:</label></td> <td><textarea id="interests" name="interests" rows="6" cols="30"><?php echo $interests; ?></textarea></td></tr> <tr> <td><label for="share">Anything else you would like to share with us?</label></td> <td><textarea id="share" name="share" rows="6" cols="30"> <?php echo $share; ?></textarea></td></tr> <tr> <td><span class="style1">*</span><label for="reference">Please provide one reference:</label></td> <td><textarea id="reference" name="reference" rows="6" cols="30"><?php echo $reference; ?></textarea></td></tr></table> <p id="rform">Family requirements </p><hr /> <table id="third"> <tr> <td><label for="aupair">What kink of au pair do you require?</label></td> <td><select id="aupair" name="aupair"> <option value="aupairplus" <?php if (!empty($aupair) && $aupair == 'aupairplus') echo 'selected = "selected"'; ?>>Au Pair Plus (max. 40 h/week)</option> <option value="aupaircouple" <?php if (!empty($aupair) && $aupair == 'aupaircouple') echo 'selected = "selected"'; ?>>Au Pair Couple</option> <option value="au_pair" <?php if (!empty($aupair) && $aupair == 'au_pair') echo 'selected = "selected"'; ?>>Au Pair (25 h/week)</option> </select></td></tr> <tr> <td><label for="natpreference">Any preference on nationality</label></td> <td><select id="natpreference" name="natpreference"> <option value="yes" <?php if (!empty($natpreference) && $natpreference == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($natpreference) && $vnatpreference == 'no') echo 'selected = "selected"'; ?>>No</option> </select></td></tr> <tr> <td><label for="natspecification">Please specify:</label></td> <td><input type="text" id="natspecification" name="natspecification" value="<?php echo $natspecification; ?>" /></td></tr> <tr> <td><label for="englishlevel">Level of English</label></td> <td><select id="englishlevel" name="englishlevel"> <option value="any" <?php if (!empty($englishlevel) && $englishlevel == 'any') echo 'selected = "selected"'; ?>>Any</option> <option value="basic" <?php if (!empty($natpreference) && $englishlevel == 'basic') echo 'selected = "selected"'; ?>>Basic</option> <option value="medium" <?php if (!empty($englishlevel) && $englishlevel == 'medium') echo 'selected = "selected"'; ?>>Medium</option> <option value="fluent" <?php if (!empty($englishlevel) && $englishlevel == 'fluent') echo 'selected = "selected"'; ?>>Fluent</option> </select></td></tr> <tr> <td><label for="aupairgender">Preferred gender of the au pair:</label></td> <td><select id="aupairgender" name="aupairgender"> <option value="any" <?php if (!empty($aupairgender) && $aupairgender == 'any') echo 'selected = "selected"'; ?>>Any</option> <option value="male" <?php if (!empty($aupairgender) && $aupairgender == 'male') echo 'selected = "selected"'; ?>>Male</option> <option value="female" <?php if (!empty($aupairgender) && $aupairgender == 'female') echo 'selected = "selected"'; ?>>Female</option> </select></td></tr> <tr> <td><label for="driver">Do you require a driver?</label></td> <td><select id="driver" name="driver"> <option value="any" <?php if (!empty($driver) && $driver == 'any') echo 'selected = "selected"'; ?>>Any</option> <option value="yes" <?php if (!empty($driver) && $driver == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($driver) && $driver == 'no') echo 'selected = "selected"'; ?>>No</option> </select></td></tr> <tr> <td><label for="car">Do you provide a car?</label></td> <td><select id="car" name="car"> <option value="yes" <?php if (!empty($car) && $car == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($car) && $car == 'no') echo 'selected = "selected"'; ?>>No</option> <option value="onlyjob" <?php if (!empty($car) && $car == 'onlyjob') echo 'selected = "selected"'; ?>>Only for job related use</option> </select></td></tr> <tr> <td><label for="smoker">Would you consider a smoker?</label></td> <td><select id="smoker" name="smoker"> <option value="yes" <?php if (!empty($smoker) && $smoker == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($smoker) && $smoker == 'no') echo 'selected = "selected"'; ?>>No</option> <option value="not_in_the_house" <?php if (!empty($smoker) && $smoker == 'not_in_the_house') echo 'selected = "selected"'; ?>>Not in front of the children or in the house</option> <option value="Any" <?php if (!empty($smoker) && $smoker == 'any') echo 'selected = "selected"'; ?>>Any</option> </select></td></tr> <tr> <td><label for="vegaupair">Would you accept a vegetarian au pair?</label></td> <td><select id="vegaupair" name="vegaupair"> <option value="yes" <?php if (!empty($vegaupair) && $vegaupair == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($vegaupair) && $vegaupair == 'no') echo 'selected = "selected"'; ?>>No</option> </select></td></tr> <tr> <td><span class="style1">*</span><label for="duration">Duration of stay:</label></td> <td><input type="text" id="duration" name="duration" value="<?php echo $duration; ?>" /></td></tr> <tr> <td><label for="weekhrs"><span class="style1">*</span>How many hours per week?</label></td> <td><input type="text" id="weekhrs" name="weekhrs" value="<?php echo $weekhrs; ?>" /></td></tr> <tr> <td><span class="style1">*</span><label for="money"> Pocket money:</label></td> <td><input type="text" id="money" name="money" value="<?php echo $money; ?>" /></td></tr> <tr> <td><label for="engcourses">Would you be happy to contribute towards English classes costs?</label></td> <td><select id="engcourses" name="engcourses"> <option value="yes" <?php if (!empty($engcourses) && $engcourses == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($engcourses) && $engcourses == 'no') echo 'selected = "selected"'; ?>>No</option> </select></td></tr> <tr> <td><label for="choirs">Please specify the au pair's duties (light housework, washing/ironing, tidying, cooking, caring for pets,etc) :</label></td> <td> <textarea id="choirs" name="choirs" rows="6" cols="30"><?php echo $choirs; ?></textarea></td></tr> <tr> <td><span class="style1">*</span><label for="start">When would you like the au pair to start?</label></td> <td><input type="text" id="start" name="start" value="<?php echo $start; ?>" /></td></tr> <tr> <td><label for="hadaupair">Have you ever had an au pair?</label></td> <td><select id="hadaupair" name="hadaupair"> <option value="yes" <?php if (!empty($hadaupair) && $hadaupair == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($hadaupair) && $hadaupair == 'no') echo 'selected = "selected"'; ?>>No</option> </select></td></tr> <tr> <td><label for="comments">Anything else you would like to share with the au pair?</label></td> <td><textarea id="comments" name="comments" rows="6" cols="30"><?php echo $comments; ?></textarea></td></tr> </table> <p id="rform">Please provide details of your home</p><hr /> <table id="fourth"> <tr> <td><span class="style1">*</span> <label for="homespec">Please describe your home(how many bedrooms ,bathrooms, facilities):</label></td> <td><textarea id="homespec" name="homespec" rows="6" cols="30"><?php echo $homespec; ?></textarea></td></tr> <tr> <td><span class="style1">*</span> <label for="aupairroom">Please describe the au pair’s accommodation(please include any facilities like Internet, use of computer, tv/dvd in their room, etc) :</label></td> <td><textarea id="aupairroom" name="aupairroom" rows="6" cols="30"><?php echo $aupairroom; ?></textarea></td></tr> <tr> <td><span class="style1">*</span> <label for="amenities">Please describe the area where you live and any amenities:</label></td> <td><textarea id="amenities" name="amenities" rows="6" cols="30"><?php echo $amenities; ?></textarea></td></tr> <tr> <td><span class="style1">*</span> <input name="agree" type="checkbox" value=" <?php echo 'agreed = "agreed"'; ?>" /> I have read and agreed to the <a href="#">Terms & Conditions</a> of business.</td> <td> </td></tr> <tr> <td><br /><input type="submit" value="Submit" name="submit" /></td> <td> </td></tr> </table> </form> </fieldset> <div id="footer"> <ul> <li><a href="#" title="Home">Home</a></li> <li>|</li> <li><a href="#" title="About Us">About Us</a></li> <li>|</li> <li><a href="#" title="Shopping Cart">Shopping Cart</a></li> <li>|</li> <li><a href="#" title="Contact Us">Contact Us</a></li> </ul> <p>Copyright Information Goes Here</p> <p></a>, Thanks to <a href="#</a></p> </div> </div> <!--right part end --> <div class="spacer"> </div> </div> <!--body part end --> </div> </body> </html> Many, many thanks for helping me. If you need any help with SEO, i'm an expert with that. Val Quote Link to comment https://forums.phpfreaks.com/topic/163530-please-help-with-php/#findComment-862941 Share on other sites More sharing options...
ldougherty Posted June 24, 2009 Share Posted June 24, 2009 you've got a lot going on there, try this.. <!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"> <head> <title>Aupairs</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link href="style1.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="div-wrapper"> <!--body part start --> <div id="mainbody"> <!--left part srart --> <!--left part emd --> <!--right part start --> <div id="rightpart"> <a href="html/index.html"></a> <h1>Au Pairs</h1> <h2 class="slogan">It's never been Easier </h2> <h2 class="welcom"><span>Welcome</span> to The Au Pairs Simple Agency </h2> <p id="about">The Au Pairs Simple Agency is based in Sussex and it started providing au pairs to families in 2009 after realizing that the market needed a reliable, serious, trustworthy agency to provide au pairs while offering value for money.<br /> We have the most competitive prices on the market and we are working to provide professional services while maintaining high standards of service.</p> <fieldset> <?php if (isset($_POST['submit'])) { $title = $_POST['title']; $name = $_POST['name']; $surname = $_POST['surname']; $address = $_POST['address']; $postcode = $_POST['postcode']; $phone = $_POST['phone']; $mobile = $_POST['mobile']; $email = $_POST['email']; $mocupation = $_POST['mocupation']; $focupation = $_POST['focupation']; $mnationality = $_POST['mnationality']; $fnationality = $_POST['fnationality']; $practiceit = $_POST['practiceit']; $freligion = $_POST['freligion']; $language = $_POST['language']; $childna = $_POST['childna']; $disabledm = $_POST['disabledm']; $disabledma = $_POST['disabledma']; $babye = $_POST['babye']; $singlep = $_POST['singlep']; $pets = $_POST['pets']; $anyhelp = $_POST['anyhelp']; $vegetarian = $_POST['vegetarian']; $smoke = $_POST['smoke']; $interests = $_POST['interests']; $share = $_POST['share']; $reference = $_POST['reference']; $aupair = $_POST['aupair']; $natpreference = $_POST['natpreference']; $natspecification = $_POST['natspecification']; $englishlevel = $_POST['englishlevel']; $aupairgender = $_POST['aupairgender']; $driver = $_POST['driver']; $car = $_POST['car']; $smoker = $_POST['smoker']; $vegaupair = $_POST['vegaupair']; $duration = $_POST['duration']; $weekhrs = $_POST['weekhrs']; $money = $_POST['money']; $engcourses = $_POST['engcourses']; $choirs = $_POST['choirs']; $start = $_POST['start']; $hadaupair = $_POST['hadaupair']; $comments = $_POST['comments']; $homespec = $_POST['homespec']; $aupairroom = $_POST['aupairroom']; $amenities = $_POST['amenities']; $agree = $_POST['agree']; $output_form = false; if (empty($name)) { echo '<b style="font-weight:bold;color:red"> Please type in your name.</b><br />'; $output_form = true; } if (empty($surname)) { echo '<b style="font-weight:bold;color:red">Please type in your surname.</b><br />'; $output_form = true; } if (empty($address)) { echo '<b style="font-weight:bold;color:red">Please type in your address.</b><br />'; $output_form = true; } if (empty($postcode)) { echo '<b style="font-weight:bold;color:red">Please type in your postcode.</b><br />'; $output_form = true; } if (empty($phone)) { echo '<b style="font-weight:bold;color:red">Please type in your phone number.</b><br />'; $output_form = true; } if (empty($email)) { echo '<b style="font-weight:bold;color:red">Please type in your email.</b><br />'; $output_form = true; } if (empty($mocupation)) { echo '<b style="font-weight:bold;color:red">Please type in the mother\'s occupation.</b><br />'; $output_form = true; } if (empty($focupation)) { echo '<b style="font-weight:bold;color:red">Please type in the father\'s occupation.</b><br />'; $output_form = true; } if (empty($mnationality)) { echo '<b style="font-weight:bold;color:red">Please type in the mother\'s nationality.</b><br />'; $output_form = true; } if (empty($fnationality)) { echo '<b style="font-weight:bold;color:red">Please type in the father\'s nationality.</b><br />'; $output_form = true; } if (empty($freligion)) { echo '<b style="font-weight:bold;color:red">Please type in the family religion.</b><br />'; $output_form = true; } if (empty($language)) { echo '<b style="font-weight:bold;color:red">Please type in the family language.</b><br />'; $output_form = true; } if (empty($childna)) { echo '<b style="font-weight:bold;color:red"> Please type in the children\'s names and ages.</b><br />'; $output_form = true; } if (empty($reference)) { echo '<b style="font-weight:bold;color:red">Please provide name,relationship,phone and email address of one referee.</b><br />'; $output_form = true; } if (empty($duration)) { echo '<b style="font-weight:bold;color:red">Please type in the duration of stay.</b><br />'; $output_form = true; } if (empty($weekhrs)) { echo '<b style="font-weight:bold;color:red">Please provide how many hours per week are required.</b><br />'; $output_form = true; } if (empty($money)) { echo '<b style="font-weight:bold;color:red">Please type in the poket money.</b><br />'; $output_form = true; } if (empty($start)) { echo '<b style="font-weight:bold;color:red">Please tell us when would you like the aupair to start.</b><br />'; $output_form = true; } if (empty($homespec)) { echo '<b style="font-weight:bold;color:red">Please describe your home.</b><br />'; $output_form = true; } if (empty($aupairroom)) { echo '<b style="font-weight:bold;color:red">Please describe the au pair\'s accommodation.</b><br />'; $output_form = true; } if (empty($amenities)) { echo '<b style="font-weight:bold;color:red">Please describe the area where you live.</b><br />'; $output_form = true; } if (empty($agree)) { echo '<b style="font-weight:bold;color:red">Please tick the "I agree" box at the bottom of the form.</b><br />'; $output_form = true; } else { $output_form = true; $dbc = mysqli_connect('', '', '', '') or die('Error connecting to MySQL server.'); $query = "INSERT INTO TABLE (title, name, surname, address, phone, mobile, email, mocupation, focupation,". "mnationality, fnationality, freligion, practiceit, language, childna, disabledm, disabledma, babye, singlep,". "pets, anyhelp, vegetarian, smoke, interests, share, reference, aupair, natpreference, natspecification, englishlevel,". "aupairgender, driver, car, smoker, vegaupair, duration, weekhrs, money, engcourses, choirs, start, hadaupair,". "comments, homespec, aupairroom, amenities, agree) " . "VALUES ('$title', '$name', '$surname', '$address', '$phone', '$mobile', '$email', '$mocupation', '$focupation',". "'$mnationality', '$fnationality', '$freligion', '$practiceit', '$language', '$childna', '$disabledm', '$disabledma', '$babye', '$singlep',". "'$pets', '$anyhelp', '$vegetarian', '$smoke', '$interests', '$share', '$reference', '$aupair', '$natpreference', '$natspecification', '$englishlevel',". "'$aupairgender', '$driver', '$car', '$smoker', '$vegaupair', '$duration', '$weekhrs', '$money', '$engcourses', '$choirs', '$start', '$hadaupair',". "'$comments', '$homespec', '$aupairroom', '$amenities', '$agree')"; $result = mysqli_query($dbc, $query) or die('Error querying database.'); mysqli_close($dbc); exit('Thank you for registering with us!'); } } ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <p id="form">Family registration form</p><br /> <table id="first"> <tr> <td><label for="title"> Title:</label></td> <td><select id="title" name="title"> <option value="mr" <?php if (!empty($mr) && $title == 'mr') echo 'selected = "selected"'; ?>>Mr</option> <option value="mrs" <?php if (!empty($mrs) && $title == 'mrs') echo 'selected = "selected"'; ?>>Mrs</option> <option value="ms" <?php if (!empty($ms) && $title == 'ms') echo 'selected = "selected"'; ?>>Ms</option> </select><br /></td></tr> <tr> <td><span class="style1">*</span><label for="name">First name:</label></td> <td><input type="text" id="name" name="name" value="<?php echo $name; ?>" /> </td></tr> <tr> <td><span class="style1">*</span><label for="surname">Surname:</label></td> <td><input type="text" id="score" name="surname" value="<?php echo $surname; ?>" /> </td></tr> <tr> <td><span class="style1">*</span><label for="address">Address:</label><br /></td> <td><textarea id="address" name="address" rows="6" cols="30"><?php echo $address; ?></textarea></td></tr> <tr> <td><span class="style1">*</span><label for="postcode">Postcode:</label></td> <td><input type="text" id="postcode" name="postcode" value="<?php echo $postcode; ?>" /></td></tr> <tr> <td><span class="style1">*</span><label for="phone">Tel number:</label></td> <td><input type="text" id="score" name="phone" value="<?php echo $phone; ?>" /> </td></tr> <tr> <td><label for="mobile"> Mobile:</label></td> <td><input type="text" id="score" name="mobile" value="<?php echo $mobile; ?>" /></td></tr> <tr> <td><span class="style1">*</span><label for="email">Email:</label></td> <td><input type="text" id="email" name="email" value="<?php echo $email; ?>" /></td></tr> </table> <p id="rform">Please provide the following personal information: </p><hr /> <br /><br /> <table id="second"> <tr> <td><span class="style1">*</span><label for="mocupation">Mother’s occupation:</label></td> <td><input type="text" id="mocupation" name="mocupation" value="<?php echo $mocupation; ?>" /> </td></tr> <tr> <td><span class="style1">*</span><label for="focupation">Father’s occupation:</label></td> <td><input type="text" id="focupation" name="focupation" value="<?php echo $focupation; ?>" /> </td></tr> <tr> <td><span class="style1">*</span><label for="mnationality">Mother’s nationality:</label></td> <td><input type="text" id="mnationality" name="mnationality" value="<?php echo $mnationality; ?>" /> </td></tr> <tr> <td><span class="style1">*</span><label for="fnationality">Father’s nationality:</label></td> <td><input type="text" id="fnationality" name="fnationality" value="<?php echo $fnationality; ?>" /> </td></tr> <tr> <td><span class="style1">*</span><label for="freligion">Family’s religion:</label></td> <td><input type="text" id="freligion" name="freligion" value="<?php echo $freligion; ?>" /> </td></tr> <tr> <td> <label for="practiceit">Do you practice it:</label></td> <td><select id="practiceit" name="practiceit"> <option value="yes" <?php if (!empty($practiceit) && $practiceit == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($practiceit) && $practiceit == 'no') echo 'selected = "selected"'; ?>>No</option> </select></td></tr> <tr> <td><span class="style1">*</span><label for="language">Spoken language in family home:</label></td> <td><input type="text" id="language" name="language" value="<?php echo $language; ?>" /> </td></tr> <tr> <td><span class="style1">*</span><label for="childna">Children’s names and ages:</label></td> <td><textarea id="childna" name="childna" rows="6" cols="30"><?php echo $childna; ?></textarea></td></tr> <tr> <td><label for="disabledm">Are any of the family members disabled:</label></td> <td><select id="disabledm" name="disabledm"> <option value="yes" <?php if (!empty($disabledm) && $disabledm == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($disabledm) && $disabledm == 'no') echo 'selected = "selected"'; ?>>No</option> </select></td></tr> <tr> <td><label for="disabledma">If yes please specify:</label></td> <td><textarea id="disabledma" name="disabledma" rows="6" cols="30"><?php echo $address; ?></textarea></td></tr> <tr> <td><label for="babye">Is a baby expected?</label></td> <td><select id="babye" name="babye"> <option value="yes" <?php if (!empty($babyer) && $babye == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($babye) && $babye == 'no') echo 'selected = "selected"'; ?>>No</option> </select></td></tr> <tr> <td><label for="singlep">Are you a single parent ?</label></td> <td><select id="singlep" name="singlep"> <option value="yes" <?php if (!empty($singlep) && $singlep == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($singlep) && $singlep == 'no') echo 'selected = "selected"'; ?>>No</option> </select></td></tr> <tr> <td><label for="pets">Do you have pets? If yes please specify:</label></td> <td><textarea id="pets" name="pets" rows="6" cols="30"><?php echo $pets; ?></textarea></td></tr> <tr> <td><label for="anyhelp">Do you have any other help (gardener, cleaner, family help)? please specify:</label></td> <td><textarea id="anyhelp" name="anyhelp" rows="6" cols="30"><?php echo $anyhelp; ?></textarea></td></tr> <tr> <td><label for="vegetarian">Are you a vegetarian?</label></td> <td><select id="vegetarian" name="vegetarian"> <option value="yes" <?php if (!empty($vegetarian) && $vegetarian == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($vegetarian) && $vegetarian == 'no') echo 'selected = "selected"'; ?>>No</option> </select></td></tr> <tr> <td><label for="smoke">Do you smoke?</label></td> <td><select id="smoke" name="smoke"> <option value="yes" <?php if (!empty($smoke) && $smoke == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($smoke) && $smoke == 'no') echo 'selected = "selected"'; ?>>No</option> <option value="not_with_children" <?php if (!empty($smoke) && $smoke == 'not_with_children') echo 'selected = "selected"'; ?>>Not in the house or in front of children</option> </select></td></tr> <tr> <td><label for="interests">Family interests:</label></td> <td><textarea id="interests" name="interests" rows="6" cols="30"><?php echo $interests; ?></textarea></td></tr> <tr> <td><label for="share">Anything else you would like to share with us?</label></td> <td><textarea id="share" name="share" rows="6" cols="30"> <?php echo $share; ?></textarea></td></tr> <tr> <td><span class="style1">*</span><label for="reference">Please provide one reference:</label></td> <td><textarea id="reference" name="reference" rows="6" cols="30"><?php echo $reference; ?></textarea></td></tr></table> <p id="rform">Family requirements </p><hr /> <table id="third"> <tr> <td><label for="aupair">What kink of au pair do you require?</label></td> <td><select id="aupair" name="aupair"> <option value="aupairplus" <?php if (!empty($aupair) && $aupair == 'aupairplus') echo 'selected = "selected"'; ?>>Au Pair Plus (max. 40 h/week)</option> <option value="aupaircouple" <?php if (!empty($aupair) && $aupair == 'aupaircouple') echo 'selected = "selected"'; ?>>Au Pair Couple</option> <option value="au_pair" <?php if (!empty($aupair) && $aupair == 'au_pair') echo 'selected = "selected"'; ?>>Au Pair (25 h/week)</option> </select></td></tr> <tr> <td><label for="natpreference">Any preference on nationality</label></td> <td><select id="natpreference" name="natpreference"> <option value="yes" <?php if (!empty($natpreference) && $natpreference == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($natpreference) && $vnatpreference == 'no') echo 'selected = "selected"'; ?>>No</option> </select></td></tr> <tr> <td><label for="natspecification">Please specify:</label></td> <td><input type="text" id="natspecification" name="natspecification" value="<?php echo $natspecification; ?>" /></td></tr> <tr> <td><label for="englishlevel">Level of English</label></td> <td><select id="englishlevel" name="englishlevel"> <option value="any" <?php if (!empty($englishlevel) && $englishlevel == 'any') echo 'selected = "selected"'; ?>>Any</option> <option value="basic" <?php if (!empty($natpreference) && $englishlevel == 'basic') echo 'selected = "selected"'; ?>>Basic</option> <option value="medium" <?php if (!empty($englishlevel) && $englishlevel == 'medium') echo 'selected = "selected"'; ?>>Medium</option> <option value="fluent" <?php if (!empty($englishlevel) && $englishlevel == 'fluent') echo 'selected = "selected"'; ?>>Fluent</option> </select></td></tr> <tr> <td><label for="aupairgender">Preferred gender of the au pair:</label></td> <td><select id="aupairgender" name="aupairgender"> <option value="any" <?php if (!empty($aupairgender) && $aupairgender == 'any') echo 'selected = "selected"'; ?>>Any</option> <option value="male" <?php if (!empty($aupairgender) && $aupairgender == 'male') echo 'selected = "selected"'; ?>>Male</option> <option value="female" <?php if (!empty($aupairgender) && $aupairgender == 'female') echo 'selected = "selected"'; ?>>Female</option> </select></td></tr> <tr> <td><label for="driver">Do you require a driver?</label></td> <td><select id="driver" name="driver"> <option value="any" <?php if (!empty($driver) && $driver == 'any') echo 'selected = "selected"'; ?>>Any</option> <option value="yes" <?php if (!empty($driver) && $driver == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($driver) && $driver == 'no') echo 'selected = "selected"'; ?>>No</option> </select></td></tr> <tr> <td><label for="car">Do you provide a car?</label></td> <td><select id="car" name="car"> <option value="yes" <?php if (!empty($car) && $car == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($car) && $car == 'no') echo 'selected = "selected"'; ?>>No</option> <option value="onlyjob" <?php if (!empty($car) && $car == 'onlyjob') echo 'selected = "selected"'; ?>>Only for job related use</option> </select></td></tr> <tr> <td><label for="smoker">Would you consider a smoker?</label></td> <td><select id="smoker" name="smoker"> <option value="yes" <?php if (!empty($smoker) && $smoker == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($smoker) && $smoker == 'no') echo 'selected = "selected"'; ?>>No</option> <option value="not_in_the_house" <?php if (!empty($smoker) && $smoker == 'not_in_the_house') echo 'selected = "selected"'; ?>>Not in front of the children or in the house</option> <option value="Any" <?php if (!empty($smoker) && $smoker == 'any') echo 'selected = "selected"'; ?>>Any</option> </select></td></tr> <tr> <td><label for="vegaupair">Would you accept a vegetarian au pair?</label></td> <td><select id="vegaupair" name="vegaupair"> <option value="yes" <?php if (!empty($vegaupair) && $vegaupair == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($vegaupair) && $vegaupair == 'no') echo 'selected = "selected"'; ?>>No</option> </select></td></tr> <tr> <td><span class="style1">*</span><label for="duration">Duration of stay:</label></td> <td><input type="text" id="duration" name="duration" value="<?php echo $duration; ?>" /></td></tr> <tr> <td><label for="weekhrs"><span class="style1">*</span>How many hours per week?</label></td> <td><input type="text" id="weekhrs" name="weekhrs" value="<?php echo $weekhrs; ?>" /></td></tr> <tr> <td><span class="style1">*</span><label for="money"> Pocket money:</label></td> <td><input type="text" id="money" name="money" value="<?php echo $money; ?>" /></td></tr> <tr> <td><label for="engcourses">Would you be happy to contribute towards English classes costs?</label></td> <td><select id="engcourses" name="engcourses"> <option value="yes" <?php if (!empty($engcourses) && $engcourses == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($engcourses) && $engcourses == 'no') echo 'selected = "selected"'; ?>>No</option> </select></td></tr> <tr> <td><label for="choirs">Please specify the au pair's duties (light housework, washing/ironing, tidying, cooking, caring for pets,etc) :</label></td> <td> <textarea id="choirs" name="choirs" rows="6" cols="30"><?php echo $choirs; ?></textarea></td></tr> <tr> <td><span class="style1">*</span><label for="start">When would you like the au pair to start?</label></td> <td><input type="text" id="start" name="start" value="<?php echo $start; ?>" /></td></tr> <tr> <td><label for="hadaupair">Have you ever had an au pair?</label></td> <td><select id="hadaupair" name="hadaupair"> <option value="yes" <?php if (!empty($hadaupair) && $hadaupair == 'yes') echo 'selected = "selected"'; ?>>Yes</option> <option value="no" <?php if (!empty($hadaupair) && $hadaupair == 'no') echo 'selected = "selected"'; ?>>No</option> </select></td></tr> <tr> <td><label for="comments">Anything else you would like to share with the au pair?</label></td> <td><textarea id="comments" name="comments" rows="6" cols="30"><?php echo $comments; ?></textarea></td></tr> </table> <p id="rform">Please provide details of your home</p><hr /> <table id="fourth"> <tr> <td><span class="style1">*</span> <label for="homespec">Please describe your home(how many bedrooms ,bathrooms, facilities):</label></td> <td><textarea id="homespec" name="homespec" rows="6" cols="30"><?php echo $homespec; ?></textarea></td></tr> <tr> <td><span class="style1">*</span> <label for="aupairroom">Please describe the au pair’s accommodation(please include any facilities like Internet, use of computer, tv/dvd in their room, etc) :</label></td> <td><textarea id="aupairroom" name="aupairroom" rows="6" cols="30"><?php echo $aupairroom; ?></textarea></td></tr> <tr> <td><span class="style1">*</span> <label for="amenities">Please describe the area where you live and any amenities:</label></td> <td><textarea id="amenities" name="amenities" rows="6" cols="30"><?php echo $amenities; ?></textarea></td></tr> <tr> <td><span class="style1">*</span> <input name="agree" type="checkbox" value=" <?php echo 'agreed = "agreed"'; ?>" /> I have read and agreed to the <a href="#">Terms & Conditions</a> of business.</td> <td> </td></tr> <tr> <td><br /><input type="submit" value="Submit" name="submit" /></td> <td> </td></tr> </table> </form> </fieldset> <div id="footer"> <ul> <li><a href="#" title="Home">Home</a></li> <li>|</li> <li><a href="#" title="About Us">About Us</a></li> <li>|</li> <li><a href="#" title="Shopping Cart">Shopping Cart</a></li> <li>|</li> <li><a href="#" title="Contact Us">Contact Us</a></li> </ul> <p>Copyright Information Goes Here</p> <p>Designed by <a href="http://www.free-css-templates.com/">Free CSS Templates</a>, Thanks to <a href="http://www.legalhelpers.com/bankruptcy-information.html">Bankruptcy Information</a></p> </div> </div> <!--right part end --> <div class="spacer"> </div> </div> <!--body part end --> </div> </body> </html> exit() may be not the best way to do this but its a simple solution.. Quote Link to comment https://forums.phpfreaks.com/topic/163530-please-help-with-php/#findComment-862947 Share on other sites More sharing options...
bebelushu Posted June 25, 2009 Author Share Posted June 25, 2009 Thanks a lot guys, i finally managed to make it work the way i wanted. Thank you very much for your help and if you have any SEO related questions please don't hesitate to ask me. Many thanks Val Quote Link to comment https://forums.phpfreaks.com/topic/163530-please-help-with-php/#findComment-863212 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.