Jump to content

dnbmadness

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

dnbmadness's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi guys, I've been writing a simple form with user input and file upload abilities. Everything was working okay... kind of. I can capture all of the users info, file uploading is working for the image field but not the CV field. Also, when images are saved on the server, I cannot open them? Here is my form: http://www.soft-links.co.uk/ and here is my PHP code (please note I'm no expert, my code may be messy). Why can I not capture both the image and CV? Also, is it possible to add checks for type etc? The image field should only upload bmp, jpg, jpeg, gifs and pngs. The CV field should only allow doc, docx and PDFs. <?php ini_set('display_errors',1); error_reporting(E_ALL); ?> <?php include ('connect.php'); //This is the directory where images will be saved $target = "images/"; $target = $target . basename( $_FILES['photo']['name']); //This is the directory where images will be saved $target2 = "cv/"; $target2 = $target2 . basename( $_FILES['cv']['name']); // Get values from form $first_name = $_POST['first_name']; $surname = $_POST['surname']; $address_line_1 = $_POST['address_line_1']; $address_line_2 = $_POST['address_line_2']; $city = $_POST['city']; $post_code = $_POST['post_code']; $country = $_POST['country']; $date_of_birth = $_POST['date_of_birth']; $interests = $_POST['interests']; $height = $_POST['height']; $chest_size = $_POST['chest_size']; $waist_size = $_POST['waist_size']; $inside_leg_size = $_POST['inside_leg_size']; $outside_leg_size = $_POST['outside_leg_size']; $shoe_size = $_POST['shoe_size']; $female_dress_size = $_POST['female_dress_size']; $passport = $_POST['passport']; $driving_license = $_POST['driving_license']; $pic = ($_FILES['photo']['name']); $cv = ($_FILES['cv']['name']); // Insert data into mysql $sql="INSERT INTO $tbl_name(first_name, surname, address_line_1, address_line_2, city, post_code, country, date_of_birth, interests, height, chest_size, waist_size, inside_leg_size, outside_leg_size, shoe_size, female_dress_size, passport, driving_license, photo, cv)VALUES('$first_name', '$surname', '$address_line_1', '$address_line_2', '$city', '$post_code', '$country', '$date_of_birth', '$interests', '$height', '$chest_size', '$waist_size', '$inside_leg_size', '$outside_leg_size', '$shoe_size', '$female_dress_size', '$passport', '$driving_license', '$pic', '$cv')"; $result=mysql_query($sql); //Writes the photo to the server if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) { //Tells you if its all ok echo "The file ". basename( $_FILES['photo']['name']). " has been uploaded, and your information has been added to the directory"; } else { //Gives and error if its not echo "Sorry, there was a problem uploading your photo."; } // ---------------------------- // //Writes users cv to the server if(move_uploaded_file($_FILES['cv']['tmp_name'], $target)) { //Tells you if its all ok echo "The file ". basename( $_FILES['cv']['name']). " has been uploaded, and your information has been added to the directory"; } else { //Gives and error if its not echo "Sorry, there was a problem uploading your cv."; } // ---------------------------- // // if successfully insert data into database, displays message "Successful". if($result){ echo "Successful"; echo "<br>"; echo "<a href='index.php'>Back to main page</a>"; } else { echo "ERROR"; } ?> <?php // close connection mysql_close(); ?>
  2. Hi guys, I've been going crazy over this and I'm hoping someone can help me. I'm making a website for a friend and I'm stuck on sending the model over to the contact page (from one form to another on a different page using $_POST). Here is the website : www.ipgetter.com/test I have successfully posted the Make variable to the contact us page, but I can't get the model sent over (the select boxes have different names). Example: <select class="form-dropdown" style="width:150px" id="input_2" name="q2_make"> <option selected="selected" value="Alfa Romeo"> Alfa Romeo </option> <option value="Aston Martin"> Aston Martin </option> <option value="Audi"> Audi </option> <option value="Bently"> Bently </option> <option value="BMW"> BMW </option> <option value="Chevrolet"> Chevrolet </option> <option value="Chrysler"> Chrysler </option> <option value="Citroen"> Citroen </option> <option value="Ferrari"> Ferrari </option> <option value="Fiat"> Fiat </option> <option value="Ford"> Ford </option> <option value="Honda"> Honda </option> <option value="Hyundai"> Hyundai </option> <option value="Infiniti"> Infiniti </option> <option value="Isuzi"> Isuzi </option> <option value="Jaguar"> Jaguar </option> <option value="Jeep"> Jeep </option> <option value="Kia"> Kia </option> <option value="Lamborghini"> Lamborghini </option> <option value="Land Rover"> Land Rover </option> <option value="Lexus"> Lexus </option> <option value="Lotus"> Lotus </option> <option value="Maserati"> Maserati </option> <option value="Mazda"> Mazda </option> <option value="Mclaren"> Mclaren </option> <option value="Mercedes-Benz"> Mercedes-Benz </option> <option value="MG"> MG </option> <option value="Mini"> Mini </option> <option value="Mitsubishi"> Mitsubishi </option> <option value="Nissan"> Nissan </option> <option value="Peugeot"> Peugeot </option> <option value="Porsche"> Porsche </option> <option value="Renault"> Renault </option> <option value="Rolls-Royce"> Rolls-Royce </option> <option value="Seat"> Seat </option> <option value="Skoda"> Skoda </option> <option value="Smart"> Smart </option> <option value="Ssangyong"> Ssangyong </option> <option value="Subaru"> Subaru </option> <option value="Suzuki"> Suzuki </option> <option value="Toyota"> Toyota </option> <option value="Vauxhall"> Vauxhall </option> <option value="Volkswagen"> Volkswagen </option> <option value="Volvo"> Volvo </option> <option value="Other"> Other </option> </select> That's the make, as for the model, the select boxes have different names so how am I supposed to capture the users selection and POST it? <li class="form-line" id="id_3"> <label id="label_3" for="input_3"></label> <div id="cid_3" class="form-input"> <select class="form-dropdown" style="width:150px" id="input_3" name="q3_model"> <option selected="selected" value="147"> 147 </option> <option value="159"> 159 </option> <option value="8C"> 8C </option> <option value="Breva"> Breva </option> <option value="Giulietta"> Giulietta </option> <option value="Mito"> Mito </option> <option value="Other"> Other </option> </select> </div> </li> <li class="form-line" id="id_4"> <label id="label_4" for="input_4"></label> <div id="cid_4" class="form-input"> <select class="form-dropdown" style="width:150px" id="input_4" name="q4_model4"> <option selected="selected" value="Cygnet"> Cygnet </option> <option value="DB9"> DB9 </option> <option value="DBS"> DBS </option> <option value="Rapide"> Rapide </option> <option value="Vantage"> Vantage </option> <option value="Virage"> Virage </option> <option value="Other"> Other </option> </select> </div> </li> I want to post only the selected make/model depending on the user selection. So my question is, how can I send the users chosen model selection over to the contact page form where there is more than one different select box? These select boxes are conditional so when you select "other" as make or model make/model, you may type one in. I'd like to send that also. Any help is appreciated guys, thanks so much.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.