October 14, 201214 yr hi, ive recently been redesigining a website for a client, this also involves moving all there database info from one server hostmonster to heart internet and incorporating a new overall design look, im using dreamweaver and everything has been goin ok, i have just got the client model login page working but am having trouble with the registration page that uses the database info, i have gone through the code over and over again, but cannot understand that when i upload all the info i can enter all registration info but the pages just hangs on submit.php and i cannot get a thankyou your registration is complete detail page, here is the code, i would be gratefull if somebody could help.... <?php include 'dbconx.php'; $query = mysql_query("SELECT * FROM pages WHERE id = '4'") or die (mysql_error()); while ($r = mysql_fetch_array($query)) { $meta_key = $r["meta_key"]; $meta_desc = $r["meta_desc"]; $header_title = $r["header_title"]; $text = $r["text"]; } include 'header.php'; ?> <script type="text/javascript"> function displayLoading() { if (document.getElementById('upload-progress')) { document.getElementById('upload-progress').style.display='block'; document.getElementById('upload_hide').style.display='none'; } } </script><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Kids Management</title> <meta name="description" content="Kids Management is a successful children's agency. Kids Management represents Children from 0-17 years. We specialize in submitting children for castings with opportunities to appear in TV commercials, film roles, photographic modeling, promotions, magazines, fashion and dance productions, product advertisements and more............." /> <meta name="keywords" content="kids, kids management, management, nolan and kay, nolan & kay, nolanandkay, nolan&kay, nolan and kay management, nolan & kay management, kids, talent, agency, models, 16, theatrical, acting, adults, classes, musical theatre, entertainment, television, film, commercials, radio," /> <style type="text/css"> body,td,th { font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #000; } body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } </style> <link href="styles.css" rel="stylesheet" type="text/css" /> <link href="/stylesheet.css" rel="stylesheet" type="text/css" /> </head> <?php echo $text; ?> <?php $parents_name = $_POST["parents_name"]; $Err_parents_name = $_POST["Err_parents_name"]; $firstname = $_POST["firstname"]; $Err_firstname = $_POST["Err_firstname"]; $surname = $_POST["surname"]; $Err_surname = $_POST["Err_surname"]; $address1 = $_POST["address1"]; $Err_address1 = $_POST["Err_address1"]; $address2 = $_POST["address2"]; $city = $_POST["city"]; $Err_city = $_POST["Err_city"]; $county = $_POST["county"]; $Err_county = $_POST["Err_county"]; $postcode = $_POST["postcode"]; $Err_postcode = $_POST["Err_postcode"]; $email_address = $_POST["email_address"]; $Err_email_address = $_POST["Err_email_address"]; $telephone = $_POST["telephone"]; $Err_telephone = $_POST["Err_telephone"]; $mobile = $_POST["mobile"]; $Err_mobile = $_POST["Err_mobile"]; $sex = $_POST["sex"]; $Err_sex = $_POST["Err_sex"]; $dob_day = $_POST["dob_day"]; $dob_month = $_POST["dob_month"]; $dob_year = $_POST["dob_year"]; $height = $_POST["height"]; $Err_height = $_POST["Err_height"]; $hairlength = $_POST["hairlength"]; $Err_hairlength = $_POST["Err_hairlength"]; $haircolour = $_POST["haircolour"]; $Err_haircolour = $_POST["Err_haircolour"]; $eyecolour = $_POST["eyecolour"]; $Err_eyecolour = $_POST["Err_eyecolour"]; $ethnicorigin = $_POST["ethnicorigin"]; $Err_ethnicorigin = $_POST["Err_ethnicorigin"]; $ShoeSize = $_POST["shoesize"]; $Err_ShoeSize = $_POST["Err_shoesize"]; $loginname = $_POST["loginname"]; $Err_loginname = $_POST["Err_loginname"]; $passwd = $_POST["passwd"]; $Err_passwd = $_POST["Err_passwd"]; $repeat_passwd = $_POST["repeat_passwd"]; ?> <div id="register"> <div class="RegisterForm"> <h3>Apply To Register Your Child With Kids Management</h3> <form action="register-submit.php" method="post" enctype="multipart/form-data" onsubmit="displayLoading();"> <fieldset> <legend>Personal Information</legend> <div class="RegisterNotes"><h3>Personal Information Notes</h3></div> <div class="RegisterField"> <? if ($Err_parents_name) { echo "<li class='err'>$Err_parents_name</li>"; } ?> <label for="ParentsName">Parents Name: </label> <input type="text" name="ParentsName" size="40" value="<? echo $parents_name ?>" /> </div> <div class="RegisterField"> <? if ($Err_firstname) { echo "<li class='err'>$Err_firstname</li>"; } ?> <label for="FirstName">Childs First Name: </label> <input type="text" name="FirstName" size="40" value="<? echo $firstname ?>" /> </div> <div class="RegisterField"> <? if ($Err_surname) { echo "<li class='err'>$Err_surname</li>"; } ?> <label for="Surname">Childs Surname: </label> <input type="text" name="Surname" size="40" value="<? echo $surname ?>" /> </div> <div class="RegisterField"> <? if ($Err_address1) { echo "<li class='err'>$Err_address1</li>"; } ?> <label for="Address_1">Address: </label> <input type="text" name="Address_1" size="40" value="<? echo $address1 ?>" /> </div> <div class="RegisterField"> <label for="Address_2" > </label> <input type="text" name="Address_2" size="40" value="<? echo $address2 ?>" /> </div> <div class="RegisterField"> <? if ($Err_city) { echo "<li class='err'>$Err_city</li>"; } ?> <label for="City">City / Town: </label> <input type="text" name="City" size="40" value="<? echo $city ?>" /> </div> <div class="RegisterField"> <? if ($Err_county) { echo "<li class='err'>$Err_county</li>"; } ?> <label for="County">County: </label> <select name="County"> <option value="">Please Select</option> <? if (isset($_POST["county"])) { ?> <option value="<? echo $county ?>" selected="selected"><? echo $county?></option> <option value="">------------------</option> <? } ?> <option value="Avon"> Avon</option> <option value="Bedfordshire"> Bedfordshire</option> <option value="Berkshire"> Berkshire</option> <option value="Buckinghamshire"> Buckinghamshire</option> <option value="Cambridgeshire"> Cambridgeshire</option> <option value="Cheshire"> Cheshire</option> <option value="Cleveland"> Cleveland</option> <option value="Cornwall"> Cornwall</option> <option value="Cumbria"> Cumbria</option> <option value="Derbyshire"> Derbyshire</option> <option value="Devon"> Devon</option> <option value="Dorset"> Dorset</option> <option value="Durham"> Durham</option> <option value="Essex"> Essex</option> <option value="Gloucestershire"> Gloucestershire</option> <option value="Greater London"> Greater London</option> <option value="Greater Manchester"> Greater Manchester</option> <option value="Hampshire"> Hampshire</option> <option value="Hereford & Worcestershire"> Hereford & Worcestershire</option> <option value="Hertfordshire"> Hertfordshire</option> <option value="Humberside"> Humberside</option> <option value="Isle of Man"> Isle of Man</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"> Lincolnshire</option> <option value="Merseyside"> Merseyside</option> <option value="Norfolk"> Norfolk</option> <option value="Northamptonshire"> Northamptonshire</option> <option value="Northumberland"> Northumberland</option> <option value="Nottinghamshire"> Nottinghamshire</option> <option value="Oxfordshire"> Oxfordshire</option> <option value="Shropshire"> Shropshire</option> <option value="Somerset"> Somerset</option> <option value="Staffordshire"> Staffordshire</option> <option value="Suffolk"> Suffolk</option> <option value="Surrey"> Surrey</option> <option value="Sussex"> Sussex</option> <option value="Warwickshire"> Warwickshire</option> <option value="West Midlands"> West Midlands</option> <option value="Wiltshire"> Wiltshire</option> <option value="Yorkshire"> Yorkshire</option> </select> </div> <div class="RegisterField"> <? if ($Err_postcode) { echo "<li class='err'>$Err_postcode</li>"; } ?> <label for="Postcode">Postcode: </label> <input type="text" name="Postcode" size="40" value="<? echo $postcode ?>" /> </div> </fieldset> <fieldset> <legend>Contact Information</legend> <div class="RegisterNotes"><h3>Contact Information Notes</h3></div> <div class="RegisterField"> <? if ($Err_email_address) { echo "<li class='err'>$Err_email_address</li>"; } ?> <label for="EmailAddress">Email Address: </label> <input type="text" name="EmailAddress" size="40" value="<? echo $email_address ?>" /> </div> <div class="RegisterField"> <? if ($Err_telephone) { echo "<li class='err'>$Err_telephone</li>"; } ?> <label for="Telephone">Home Telephone: </label> <input type="text" name="Telephone" size="40" value="<? echo $telephone ?>" /> </div> <div class="RegisterField"> <? if ($Err_mobile) { echo "<li class='err'>$Err_mobile</li>"; } ?> <label for="Mobile">Mobile: </label> <input type="text" name="Mobile" size="40" value="<? echo $mobile ?>" /> </div> </fieldset> <fieldset> <legend>Profile Information</legend> <div class="RegisterNotes"><h3>Profile Information Notes</h3></div> <div class="RegisterField"> <? if (isset($_POST["firstname"])) { echo "<li class='err'>Please Select Your Childs Skills</li>"; } ?> <label for="Skills">Skills: </label> <select name="Skills[]" size="5" multiple="multiple"> <option value="dancing">Dancing</option> <option value="acting">Acting</option> <option value="singing">Singing</option> <option value="sports">Sports</option> </select> </div> <div class="RegisterField"> <? if ($Err_sex) { echo "<li class='err'>$Err_sex</li>"; } ?> <label for="Sex">Sex: </label> <input type="radio" name="Sex" value="Male"<? if ($sex == 'Male') { ?> checked="checked"<? } ?> /> Male <input type="radio" name="Sex" value="Female"<? if ($sex == 'Female') { ?> checked="checked"<? } ?> /> Female </div> <div class="RegisterField"> <label for="DOB_day">Date of Birth: </label> <select name="DOB_day"><? for ($i = 1; $i <= 31; $i++) { ?> <option value="<? echo $i ?>"<? if ($i == $dob_day) { ?> selected="selected"<? } ?>><? echo $i ?></option> <? } ?> </select> <select name="DOB_month"><? $Month = strtotime("01-01-2009"); for ($i = 0; $i <= 11; $i++) { $month = date("F", strtotime("+$i months", $Month)); ?> <option value="<? echo ($i + 1); ?>"<? if ($month == $dob_month) { ?> selected="selected"<? } ?>><? echo $month ?></option> <? } ?> </select> <select name="DOB_year"><? $Year = strtotime("01-01-". date("Y", time() + (8 * 3600))); for ($i = 0; $i <= 20; $i++) { $year = date("Y", strtotime("-$i years", $Year)); ?> <option value="<? echo $year ?>"<? if ($year == $dob_year) { ?> selected="selected"<? } ?>><? echo $year ?></option> <? } ?> </select> </div> <div class="RegisterField"> <? if ($Err_height) { echo "<li class='err'>$Err_height</li>"; } ?> <label for="Height">Height: </label> <input type="text" name="Height" size="20" value="" /> </div> <div class="RegisterField"> <? if ($Err_hairlength) { echo "<li class='err'>$Err_hairlength</li>"; } ?> <label for="HairLength">Hair Length: </label> <select name="HairLength"> <option value="">Please Select</option> <option value="long"<? if ($hairlength == 'long') { ?> selected="selected"<? } ?>>Long</option> <option value="medium"<? if ($hairlength == 'medium') { ?> selected="selected"<? } ?>>Medium</option> <option value="short"<? if ($hairlength == 'short') { ?> selected="selected"<? } ?>>Short</option> </select> </div> <div class="RegisterField"> <? if ($Err_haircolour) { echo "<li class='err'>$Err_haircolour</li>"; } ?> <label for="HairColour">Hair Colour: </label> <select name="HairColour"> <option value="">Please Select</option> <option value="black"<? if ($haircolour == 'black') { ?> selected="selected"<? } ?>>Black</option> <option value="brown"<? if ($haircolour == 'brown') { ?> selected="selected"<? } ?>>Brown</option> <option value="light_brown"<? if ($haircolour == 'light_brown') { ?> selected="selected"<? } ?>>Light Brown</option> <option value="blonde"<? if ($haircolour == 'blonde') { ?> selected="selected"<? } ?>>Blonde</option> <option value="dark_blonde"<? if ($haircolour == 'dark_blonde') { ?> selected="selected"<? } ?>>Dark Blonde</option> <option value="red"<? if ($haircolour == 'red') { ?> selected="selected"<? } ?>>Red</option> <option value="auburn"<? if ($haircolour == 'auburn') { ?> selected="selected"<? } ?>>Auburn</option> </select> </div> <div class="RegisterField"> <? if ($Err_eyecolour) { echo "<li class='err'>$Err_eyecolour</li>"; } ?> <label for="EyeColour">Eye Colour: </label> <select name="EyeColour"> <option value="">Please Select</option> <option value="blue"<? if ($eyecolour == 'blue') { ?> selected="selected"<? } ?>>Blue</option> <option value="green"<? if ($eyecolour == 'green') { ?> selected="selected"<? } ?>>Green</option> <option value="black"<? if ($eyecolour == 'black') { ?> selected="selected"<? } ?>>Black</option> <option value="brown"<? if ($eyecolour == 'brown') { ?> selected="selected"<? } ?>>Brown</option> <option value="hazel"<? if ($eyecolour == 'hazel') { ?> selected="selected"<? } ?>>Hazel</option> <option value="blue_green"<? if ($eyecolour == 'blue_green') { ?> selected="selected"<? } ?>>Blue/Green</option> <option value="blue_grey"<? if ($eyecolour == 'blue_grey') { ?> selected="selected"<? } ?>>Blue/Grey</option> <option value="green_grey"<? if ($eyecolour == 'green_grey') { ?> selected="selected"<? } ?>>Green/Grey</option> </select> </div> <div class="RegisterField"> <? if ($Err_ethnicorigin) { echo "<li class='err'>$Err_ethnicorigin</li>"; } ?> <label for="EthnicOrigin">Ethnic Origin: </label> <select name="EthnicOrigin"> <option value="">Please Select</option> <option value="white"<? if ($ethnicorigin == 'white') { ?> selected="selected"<? } ?>>White</option> <option value="mixed"<? if ($ethnicorigin == 'mixed') { ?> selected="selected"<? } ?>>Mixed Race</option> <option value="black"<? if ($ethnicorigin == 'black') { ?> selected="selected"<? } ?>>Black</option> <option value="asian"<? if ($ethnicorigin == 'asian') { ?> selected="selected"<? } ?>>Asian</option> <option value="oriental"<? if ($ethnicorigin == 'oriental') { ?> selected="selected"<? } ?>>Oriental</option> </select> </div> <div class="RegisterField"> <? if ($Err_ShoeSize) { echo "<li class='err'>$Err_ShoeSize</li>"; } ?> <label for="ShoeSize">Shoe Size: </label> <input type="text" name="ShoeSize" size="10" value="<? echo $ShoeSize ?>" /> </div> </fieldset> <fieldset> <legend>Profile Photos</legend> <? if (isset($_POST["firstname"])) { if ($firstname == '') { ?> <div class="RegisterNotes"><h3>Photo Upload Notes</h3></div> <div class="RegisterImgField"> <label for="UploadImg1">Picture to Upload 1</label> <input type="file" name="UploadImg1" /> </div> <div class="RegisterImgField"> <label for="UploadImg2">Picture to Upload 2</label> <input type="file" name="UploadImg2" /> </div> <div class="RegisterImgField"> <label for="UploadImg3">Picture to Upload 3</label> <input type="file" name="UploadImg3" /> </div> <div class="RegisterImgField"> <label for="UploadImg4">Picture to Upload 4</label> <input type="file" name="UploadImg4" /> </div> <? } else { echo "<p>Your Photos have been uploaded, no need to upload them again</p>"; } } else { ?> <div class="RegisterNotes"><h3>Photo Upload Notes</h3></div> <div class="RegisterImgField"> <label for="UploadImg1">Picture to Upload 1</label> <input type="file" name="UploadImg1" /> </div> <div class="RegisterImgField"> <label for="UploadImg2">Picture to Upload 2</label> <input type="file" name="UploadImg2" /> </div> <div class="RegisterImgField"> <label for="UploadImg3">Picture to Upload 3</label> <input type="file" name="UploadImg3" /> </div> <div class="RegisterImgField"> <label for="UploadImg4">Picture to Upload 4</label> <input type="file" name="UploadImg4" /> </div> <? } ?> </fieldset> <fieldset> <legend>Login Information</legend> <div class="RegisterNotes"><h3>Login Information Notes</h3></div> <div class="RegisterField"> <? if ($Err_loginname) { echo "<li class='err'>$Err_loginname</li>"; } ?> <label for="LoginName">Desired Login Username: </label> <input type="text" name="LoginName" size="40" value="<? echo $loginname ?>" /> </div> <div class="RegisterField"> <? if ($Err_passwd) { echo "<li class='err'>$Err_passwd</li>"; } ?> <label for="passwd">Desired Password: </label> <input type="password" name="passwd" size="40" value="<? echo $passwd ?>" /> </div> <div class="RegisterField"> <label for="repeat_passwd">Desired Password Again: </label> <input type="password" name="repeat_passwd" size="40" value="<? echo $repeat_passwd ?>" /> </div> </fieldset> <div id="upload_hide"><input type="submit" name="Submit" value="Submit Your Application" class="SubmitButton" /></div> <div id="upload-progress" style="display:none; margin-left:339px;"><img src="images/loading.gif" alt="Uploading Files" title="Uploading Files"</div> </form> </div> </div> <div id="footer"><img src="images/footer.jpg" width="1367" height="160" border="0" usemap="#Map4" /> <map name="Map4" id="Map4"> <area shape="rect" coords="286,23,420,38" href="http://www.linsianimations.co.uk" target="_blank" alt="linsianimations.co.uk" /> <area shape="rect" coords="287,43,315,54" href="index.html" alt="home page" /> <area shape="rect" coords="320,42,370,54" href="what_we_do.html" alt="what we do page" /> <area shape="rect" coords="371,43,403,53" href="search.php" alt="search page" /> <area shape="rect" coords="406,44,451,55" href="workshops.html" alt="workshops page" /> <area shape="rect" coords="452,45,488,56" href="register.php" alt="register page" /> <area shape="rect" coords="490,44,545,55" href="client_login.php" alt="client login page" /> <area shape="rect" coords="546,43,600,57" href="model_login.php" alt="model login page" /> </map> </div><!--end of footer div--> </div><!--end div wrapper--> </body> </html>
October 15, 201214 yr For starters, are you getting any error displayed? if not, you will want to set display_errors to on in the php.ini file. That will at least display any errors in your code. Also is your form action file submit.php because in your html you have it set to registration-submit.php
October 15, 201214 yr Author For starters, are you getting any error displayed? if not, you will want to set display_errors to on in the php.ini file. That will at least display any errors in your code. Also is your form action file submit.php because in your html you have it set to registration-submit.php no errors displayed, once the registration is submitted it just hangs on a white page with www.kidsmanagement.co.uk/submit.php in the address bar, il take a look at the action file title too, thanx for your reply
October 15, 201214 yr How do you know it hangs on submit.php? Where is submit.php called? The form should be processing register-submit.php. Have you got an old file called submit.php on the server that shouldn't be used or isn't there so the server hangs, in which case how does the server get to it? Your form says register-submit.php:- <form action="register-submit.php" method="post" enctype="multipart/form-data" onsubmit="displayLoading();"> Edited October 15, 201214 yr by Wickham
October 15, 201214 yr Author it displays a white page online and when or if i add error coding it comes up as undefined index on the part of the form that sends an email to the website owners &gets senders name &email address
October 15, 201214 yr $from parent_name doesn't appear in your code above (it's $parents_name above). Is it a typo? Is it in register-submit.php? What is the code for register-submit.php? Edited October 15, 201214 yr by Wickham
October 15, 201214 yr Author $from parent_name doesn't appear in your code above (it's $parents_name above). Is it a typo? Is it in register-submit.php? What is the code for register-submit.php? hi yeh sorry its a typo should be ($parents_name above) on the error report its from the line $from = stripslashes ($_POST('parents_name'])."<".stripslashes($_POST['email_address']).">";
October 15, 201214 yr I'm still not aware of the code in register-submit.php. However, have you checked that you have used the same names everywhere? In the code above you have $parents_name = $_POST["parents_name"]; but in the form you have <input type="text" name="ParentsName" size="40" value="<? echo $parents_name ?>" /> but it's name="ParentsName" which is used as the hook when you click the submit button, not the value from $parents_name which is parents_name. Does it all tie up? Edited October 15, 201214 yr by Wickham
October 15, 201214 yr Hai siUK2012 Please read this http://en.kioskea.net/faq/3140-php-notice-undefined-index http://stackoverflow.com/questions/4842759/php-undefined-index I think this will help you.If you need more help in this matter can you please share your register-submit.php file
October 15, 201214 yr Author I'm still not aware of the code in register-submit.php. However, have you checked that you have used the same names everywhere? In the code above you have $parents_name = $_POST["parents_name"]; but in the form you have <input type="text" name="ParentsName" size="40" value="<? echo $parents_name ?>" /> but it's name="ParentsName" which is used as the hook when you click the submit button, not the value from $parents_name which is parents_name. Does it all tie up? thanx for that im not really into php coding or databases slowly teaching myself though, so should i change the name to "ParentsName" through the whole of the code, i would be gratefull if you could show me from my code where these changes need to be applied, thanx for your time.
October 15, 201214 yr Author Hai siUK2012 Please read this http://en.kioskea.ne...undefined-index http://stackoverflow...undefined-index I think this will help you.If you need more help in this matter can you please share your register-submit.php file hi thanx here is my register-submit code <?php include 'dbconx.php'; $parents_name = $_POST["ParentsName"]; $firstname = $_POST["FirstName"]; $surname = $_POST["Surname"]; $address1 = $_POST["Address_1"]; $address2 = $_POST["Address_2"]; $city = $_POST["City"]; $county = $_POST["County"]; $postcode = $_POST["Postcode"]; $email_address = $_POST["EmailAddress"]; $telephone = $_POST["Telephone"]; $mobile = $_POST["Mobile"]; $sex = $_POST["Sex"]; $dob_day = $_POST["DOB_day"]; $dob_month = $_POST["DOB_month"]; $dob_year = $_POST["DOB_year"]; $date_of_birth = $dob_year."-".$dob_month."-".$dob_day; $height = $_POST["Height"]; $hairlength = $_POST["HairLength"]; $haircolour = $_POST["HairColour"]; $eyecolour = $_POST["EyeColour"]; $ethnicorigin = $_POST["EthnicOrigin"]; $shoesize = $_POST["ShoeSize"]; $folder_date = date("d-m-Y", time() + (8 * 3600)); if ($firstname == '') { } else { $bad_folder = array(' ', ' ', ' ', ' ', ' ', '\'', '&', '&', '/','Á', 'á', 'É', 'é', 'Í', 'í', 'Ó', 'ó', 'Ú', 'ú', 'Ñ', 'ñ', '(', ')', ',', '.', '´', '~'); $good_folder = array('-', '-', '-', '-', '-', '', 'and', 'and', '-', 'A', 'a', 'E', 'e', 'I', 'i', 'O', 'o', 'U', 'u', 'N', 'n', '', '', '', '', '', '-'); $page_name = $firstname."-".$surname."-".$folder_date ; $page2 = str_replace($bad_folder, $good_folder, $page_name); $folder = strtolower($page2) ; $page_url = $folder; $im = 0; for ($i = 1; $i <= 4; $i++) { if(!is_uploaded_file($_FILES["UploadImg".$i]['tmp_name'])){ } else { $file_type = $_FILES['UploadImg'.$i]['type']; $file_name = $_FILES['UploadImg'.$i]['name']; $file_size = $_FILES['UploadImg'.$i]['size']; $file_tmp = $_FILES['UploadImg'.$i]['tmp_name']; $im++; // CREATE AN UPLOAD FOLDER FOR THE APPLICATION PHOTOS - SAVE THEM FOR RETRIEVAL AT LATER DATE if(!is_dir("images/uploads/$folder")) { mkdir("images/uploads/$folder", 0777); } //get the new width variable. $ThumbWidth = 400; $SmallThumbWidth = 150; //keep image type if($file_size){ $image_result = $firstname."-".$surname."-".$im ; $image_result_large = $image_result."_large".$ext; $image_result_thumb = $image_result."_thumb"; //list width and height and keep height ratio. list($width, $height) = getimagesize($file_tmp); $imgratio=$width/$height; $newwidth = $ThumbWidth; $newheight = $ThumbWidth/$imgratio; $newSmallwidth = $SmallThumbWidth; $newSmallheight = $SmallThumbWidth/$imgratio; //function for resize image. $new_size = $newwidth ."x". $newheight; $new_Header_size = $newHeaderwidth."x".$newHeaderheight; $new_Small_size = $newSmallwidth."x".$newSmallheight; exec("/usr/bin/convert -resize $new_size! -quality 85 -sharpen 1 -strip /$file_tmp images/uploads/$folder/$image_result.jpg"); exec("/usr/bin/convert -resize $new_Small_size! -quality 85 -sharpen 1 -strip /$file_tmp images/uploads/$folder/$image_result_thumb.jpg"); copy("/$file_tmp", "images/uploads/$folder/$image_result_large"); } } } $loginname = $_POST["LoginName"]; $passwd = $_POST["passwd"]; $repeat_passwd = $_POST["repeat_passwd"]; $error = false; if (empty($parents_name)) { $error = true; $message .= '<input type="hidden" name="Err_parents_name" value="You must enter the parents name" />'; } if (empty($firstname)) { $error = true; $message .= '<input type="hidden" name="Err_firstname" value="You must enter the childs first name" />'; } if (empty($surname)) { $error = true; $message .= '<input type="hidden" name="Err_surname" value="You must enter the childs surname" />'; } if (empty($address1)) { $error = true; $message .= '<input type="hidden" name="Err_address1" value="You must enter an address" />'; } if (empty($city)) { $error = true; $message .= '<input type="hidden" name="Err_city" value="You must enter a city" />'; } if (empty($county)) { $error = true; $message .= '<input type="hidden" name="Err_county" value="You must enter a county" />'; } if (empty($email_address)) { $error = true; $message .= '<input type="hidden" name="Err_email_address" value="You must enter a valid Email Address" />'; } if (empty($telephone)) { $error = true; $message .= '<input type="hidden" name="Err_telephone" value="You must enter a telephone number" />'; } if (empty($mobile)) { $error = true; $message .= '<input type="hidden" name="Err_mobile" value="You must enter a mobile contact number" />'; } if (empty($sex)) { $error = true; $message .= '<input type="hidden" name="Err_sex" value="You must enter a sex" />'; } if (empty($height)) { $error = true; $message .= '<input type="hidden" name="Err_height" value="You must enter a height" />'; } if (empty($hairlength)) { $error = true; $message .= '<input type="hidden" name="Err_hairlength" value="You must enter a hairlength" />'; } if (empty($haircolour)) { $error = true; $message .= '<input type="hidden" name="Err_haircolour" value="You must enter a hair colour" />'; } if (empty($eyecolour)) { $error = true; $message .= '<input type="hidden" name="Err_eyecolour" value="You must enter an eye colour" />'; } if (empty($ethnicorigin)) { $error = true; $message .= '<input type="hidden" name="Err_ethnicorigin" value="You must enter an ethnic origin" />'; } if (empty($shoesize)) { $error = true; $message .= '<input type="hidden" name="Err_ShoeSize" value="You must enter the childs shoe size" />'; } if (empty($loginname)) { $error = true; $message .= '<input type="hidden" name="Err_loginname" value="You must enter a desired login name" />'; } if (empty($passwd)) { $error = true; $message .= '<input type="hidden" name="Err_passwd" value="You must enter a login password" />'; } if ($passwd == $repeat_passwd) { } else { $error = true; $message .= '<input type="hidden" name="Err_passwd" value="The passwords entered do not match." />'; } if ($error == true) { ?> <html> <head> <title>Form Error</title> </head> <body> <form action="register.php" method="post" id="error_form"> <input type="hidden" name="parents_name" value="<? echo $parents_name ?>" /> <input type="hidden" name="firstname" value="<? echo $firstname ?>" /> <input type="hidden" name="surname" value="<? echo $surname ?>" /> <input type="hidden" name="address1" value="<? echo $address1 ?>" /> <input type="hidden" name="address2" value="<? echo $address2 ?>" /> <input type="hidden" name="city" value="<? echo $city ?>" /> <input type="hidden" name="county" value="<? echo $county ?>" /> <input type="hidden" name="postcode" value="<? echo $postcode ?>" /> <input type="hidden" name="email_address" value="<? echo $email_address ?>" /> <input type="hidden" name="telephone" value="<? echo $telephone ?>" /> <input type="hidden" name="mobile" value="<? echo $mobile ?>" /> <input type="hidden" name="sex" value="<? echo $sex ?>" /> <input type="hidden" name="dob_day" value="<? echo $dob_day ?>" /> <input type="hidden" name="dob_month" value="<? echo $dob_month ?>" /> <input type="hidden" name="dob_year" value="<? echo $dob_year ?>" /> <input type="hidden" name="height" value="<? echo $height ?>" /> <input type="hidden" name="hairlength" value="<? echo $hairlength ?>" /> <input type="hidden" name="haircolour" value="<? echo $haircolour ?>" /> <input type="hidden" name="eyecolour" value="<? echo $eyecolour ?>" /> <input type="hidden" name="ethnicorigin" value="<? echo $ethnicorigin ?>" /> <input type="hidden" name="shoesize" value="<? echo $shoesize ?>" /> <input type="hidden" name="loginname" value="<? echo $loginname ?>" /> <input type="hidden" name="passwd" value="<? echo $passwd ?>" /> <input type="hidden" name="repeat_passwd" value="<? echo $repeat_passwd ?>" /> <? echo $message ?> </form> <script language="Javascript" type="text/javascript"> <!-- document.getElementById('error_form').submit(); //--> </script> </body> </html> <? } else { // INSERT THE APPLICATION INTO THE DATABASE FOR SAFE KEEPING AND EASY UPDATE OF NEW MEMBER if (file_exists("images/uploads/$folder/$firstname-$surname-1.jpg")) { $image_1 = "images/uploads/$folder/$firstname-$surname-1.jpg"; } else { $image_1 = ""; } if (file_exists("images/uploads/$folder/$firstname-$surname-2.jpg")) { $image_2 = "images/uploads/$folder/$firstname-$surname-2.jpg"; } else { $image_2 = ""; } if (file_exists("images/uploads/$folder/$firstname-$surname-3.jpg")) { $image_3 = "images/uploads/$folder/$firstname-$surname-3.jpg"; } else { $image_3 = ""; } if (file_exists("images/uploads/$folder/$firstname-$surname-4.jpg")) { $image_4 = "images/uploads/$folder/$firstname-$surname-4.jpg"; } else { $image_4 = ""; } $insert = mysql_query("INSERT INTO registrations (page_url, parents_name, firstname, surname, address1, address2, city, county, postcode, email_address, telephone, mobile, sex, date_of_birth, height, hairlength, haircolour, eyecolour, ethnic_origin, shoesize, image_1, image_2, image_3, image_4, username, passwd) VALUES ('$page_url', '$parents_name', '$firstname', '$surname', '$address1', '$address2', '$city', '$county', '$postcode', '$email_address', '$telephone', '$mobile', '$sex', '$date_of_birth', '$height', '$hairlength', '$haircolour', '$eyecolour', '$ethnicorigin', '$shoesize', '$image_1', '$image_2', '$image_3', '$image_4', '$loginname', '$passwd')") or die (mysql_error()); $id = mysql_insert_id(); $skills = $_POST["Skills"]; foreach($skills as $value) { $skills_insert_query = mysql_query("INSERT INTO registration_skills (registrant_id, skill) VALUES ('$id', '$value')") or die (mysql_error()); } // SEND THE APPLICANTS DETAILS TO STEVE AND KAREN $to="karen@kidsmanagement.co.uk, amanda@kidsmanagement.co.uk"; $subject="New Kids Management Application"; // get the sender's name and email address // we'll just plug them a variable to be used later $from = stripslashes($_POST['parents_name'])."<".stripslashes($_POST['email_address']).">"; // generate a random string to be used as the boundary marker $mime_boundary="==Multipart_Boundary_x".md5(mt_rand())."x"; // now we'll build the message headers $headers = "From: $from\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: multipart/mixed;\r\n" . " boundary=\"{$mime_boundary}\""; // here, we'll start the message body. // this is the text that will be displayed // in the e-mail $message = "You have received a new appilcation for representation from the Kids Management website:\r\n\r\n". "Parent Name: $parents_name\r\n\r\n". "Childs Name: $firstname $surname\r\n\r\n". "Address $address1\r\n". "$address2\r\n". "$city\r\n". "$county\r\n". "$postcode\r\n\r\n". "Email Address: $email_address\r\n\r\n". "Contact Telephone: $telephone\r\n\r\n". "Mobile Number: $mobile\r\n\r\n". "Childs Sex: $sex\r\n\r\n". "Date of Birth: $date_of_birth\r\n\r\n". "Height: $height\r\n\r\n". "Hair Length: $hairlength\r\n\r\n". "Hair Colour: $haircolour\r\n\r\n". "Eye Colour: $eyecolour\r\n\r\n". "Ethnic Origin: $ethnicorigin\r\n\r\n". "Shoe Size: $shoesize\r\n\r\n". "Website Login Name: $loginname\r\n\r\n"; // next, we'll build the invisible portion of the message body // note that we insert two dashes in front of the MIME boundary // when we use it $message = "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; // now we'll process our uploaded files for($i = 1; $i <= 4; $i++){ // if the upload succeded, the file will exist if (file_exists("images/uploads/$folder/$firstname-$surname-$i.jpg")) { $size = getimagesize("images/uploads/$folder/$firstname-$surname-$i.jpg"); $tmp_name = "images/uploads/$folder/$firstname-$surname-$i.jpg"; $name = "$firstname-$surname-$i.jpg"; $type = $size['mime']; // open the file for a binary read $file = fopen($tmp_name,'rb'); // read the file content into a variable $data = fread($file,filesize($tmp_name)); // close the file fclose($file); // now we encode it and split it into acceptable length lines $data = chunk_split(base64_encode($data)); // now we'll insert a boundary to indicate we're starting the attachment // we have to specify the content type, file name, and disposition as // an attachment, then add the file content. // NOTE: we don't set another boundary to indicate that the end of the // file has been reached here. we only want one boundary between each file // we'll add the final one after the loop finishes. $message .= "--{$mime_boundary}\n" . "Content-Type: {$type};\n" . " name=\"{$name}\"\n" . "Content-Disposition: attachment;\n" . " filename=\"{$name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n"; } } // here's our closing mime boundary that indicates the last of the message $message.="--{$mime_boundary}--\n"; // now we just send the message mail($to, $subject, $message, $headers); $url = 'http://www.kidsmanagement.co.uk/register-thanks.php'; } } ?>
October 15, 201214 yr ^^Rallport is correct about the mysqli though i like PDO esp in larger application have a look at it and pal do not put that code live till you have mysql injection protection (At least mysql_real_escape_string() if using mysql_) :S Alot of kiddyscripters will have alot of fun when they find out there no mysql injection protection hahah Read up on sql injection like Rallport said. Crash course:- They can run sql querys from ur textbox without protection Edited October 15, 201214 yr by motters
October 19, 201214 yr Author hi, still havent sorted this registration page i keep getting the error which is directed to this line of code. $from = stripslashes ($_POST('parents_name'])."<".stripslashes($_POST['email_address']).">"; its just the submitting part that hangs when you press submit, it dosent seem to be able to find the thankyou for submitting your info page?
October 19, 201214 yr In your form you set the name of the field to "ParentsName" so you have to use $_POST['ParentsName']
October 19, 201214 yr right here stripslashes ($_POST('parents_name']) should be stripslashes ($_POST['parents_name']) you had a ( instead of an opening [
October 22, 201214 yr Author right here stripslashes ($_POST('parents_name']) should be stripslashes ($_POST['parents_name']) you had a ( instead of an opening [ i fixed this error but now have 2 more from these lines, this is the error report, hope you can help. undefined index $im = 0; for ($i = 1; $i <= 4; $i++) { if(!is_uploaded_file($_FILES["UploadImg".$i]['tmp_name'])){ } else { $file_type = $_FILES['UploadImg'.$i]['type']; $file_name = $_FILES['UploadImg'.$i]['name']; $file_size = $_FILES['UploadImg'.$i]['size']; $file_tmp = $_FILES['UploadImg'.$i]['tmp_name']; $im++; // CREATE AN UPLOAD FOLDER FOR THE APPLICATION PHOTOS - SAVE THEM FOR RETRIEVAL AT LATER DATE if(!is_dir("images/uploads/$folder")) { mkdir("images/uploads/$folder", 0777); } //get the new width variable. $ThumbWidth = 400; $SmallThumbWidth = 150; //keep image type if($file_size){ $image_result = $firstname."-".$surname."-".$im ; $image_result_large = $image_result."_large".$ext; $image_result_thumb = $image_result."_thumb"; //list width and height and keep height ratio. list($width, $height) = getimagesize($file_tmp); $imgratio=$width/$height; $newwidth = $ThumbWidth; $newheight = $ThumbWidth/$imgratio; $newSmallwidth = $SmallThumbWidth; $newSmallheight = $SmallThumbWidth/$imgratio; //function for resize image. $new_size = $newwidth ."x". $newheight; $new_Header_size = $newHeaderwidth."x".$newHeaderheight; $new_Small_size = $newSmallwidth."x".$newSmallheight; exec("/usr/bin/convert -resize $new_size! -quality 85 -sharpen 1 -strip /$file_tmp images/uploads/$folder/$image_result.jpg"); exec("/usr/bin/convert -resize $new_Small_size! -quality 85 -sharpen 1 -strip /$file_tmp images/uploads/$folder/$image_result_thumb.jpg"); copy("/$file_tmp", "images/uploads/$folder/$image_result_large"); } } }
October 23, 201214 yr Read my previous reply. And please please please stop posting so much code. And use code tags, its the little icon above on the format toolbar that looks like <>
October 23, 201214 yr Author Read my previous reply. And please please please stop posting so much code. And use code tags, its the little icon above on the format toolbar that looks like <> hi thanx for your help so far, but im not 100% experienced with php especially when the client just wants me to fix it as the web designer they recently used pulled out of the project half way through, i have built my own login and registration pages through php from scratch for my own sites, but working with somebody elses code makes it difficult, i am working with the old code as the client has all her info there already and she has an option to upload pics within the registration process and i havent never built or used that option as yet, the reason im posting the code is because people have asked for it, im using dreamweaver would this help me to fix the code mistakes?http://help.adobe.com/en_US/dreamweaver/cs/using/WSc78c5058ca073340dcda9110b1f693f21-7bd8a.html
October 23, 201214 yr hi thanx for your help so far, but im not 100% experienced with php especially when the client just wants me to fix it as the web designer they recently used pulled out of the project half way through, i have built my own login and registration pages through php from scratch for my own sites, but working with somebody elses code makes it difficult, i am working with the old code as the client has all her info there already and she has an option to upload pics within the registration process and i havent never built or used that option as yet, the reason im posting the code is because people have asked for it, im using dreamweaver would this help me to fix the code mistakes?http://help.adobe.com/en_US/dreamweaver/cs/using/WSc78c5058ca073340dcda9110b1f693f21-7bd8a.html people dont care that you post your code we welcome it but for all things holy use some since and wrap your code in code tags. serveral people have told you this would think it would sink in
October 23, 201214 yr This thread has become confusing and unfortunately all the unnecessary code makes it difficult to follow (we really don't need to see every county, hair colour and eye colour). From what I can gather you are getting an undefined index error on the line stripslashes ($_POST['parents_name']) I think it is because your form names the parent name field as ParentsName. <input type="text" name="ParentsName" size="40" value="<? echo $parents_name ?>" /> That means in $_POST you need to use ParentsName to access it. You can either change how you code $_POST i.e. $_POST['ParentsName'] OR change how the form is coded <input type="text" name="parents_name" size="40" value="<? echo $parents_name ?>" /> I realise that as you're new to this it can be confusing but your variable names need to be consistent. If you want to change your form coding and you're using Dreamweaver, you will have to switch into codeview to change how the form is coded. Also think about the people from whom you are asking for help - look at some of your posts. Seriously, would you wade through all that?
Create an account or sign in to comment