andy_b_1502 Posted April 25, 2012 Share Posted April 25, 2012 Hi everyone. Can somebody please help me with my forms radio buttons (and also 2 fields underneath them) They cant seem to be clicked/selected in the browser? I'm really not sure what i'm doing wrong? Attached is the file with the form in. Thank you. 18194_.php Quote Link to comment Share on other sites More sharing options...
Drummin Posted April 26, 2012 Share Posted April 26, 2012 <p> <input type="radio" name="what_services" value="R" <?php echo (isset($_POST['what_services']) && $_POST['what_services']=="R" ? 'checked="checked"' : '') ?> /> </p> <p>Removal<br> <input type="radio" name="what_services" value="S" <?php echo (isset($_POST['what_services']) && $_POST['what_services']=="S" ? 'checked="checked"' : '') ?> /> </p> <p>Storage<br> <input type="radio" name="what_services" value="B" <?php echo (isset($_POST['what_services']) && $_POST['what_services']=="B" ? 'checked="checked"' : '') ?> /> </p> Quote Link to comment Share on other sites More sharing options...
andy_b_1502 Posted April 26, 2012 Author Share Posted April 26, 2012 I've added your code but it doesnt seem to work: www.removalspace.com/register00.php The radio buttons seem to be frozen and cannot be clicked in my browser? Also website AND contact name cannot be selected either Quote Link to comment Share on other sites More sharing options...
Drummin Posted April 26, 2012 Share Posted April 26, 2012 I don't see anything related to what I posted that could cause a problem. I do see that you are using session and thus all processing should be moved to the top of the page. That's a good practice regardless. <?PHP session_start(); include('php only scripts/db.php'); include('php only scripts/resize.php'); /* create an email validation function */ function validateEmailAddress($email) { return filter_var($email, FILTER_VALIDATE_EMAIL) && preg_match('/@.+\./', $email); } /* FUNCTION TO CREATE SALT */ function createSalt() { $string = md5(uniqid(rand(), true)); return substr($string, 0, 3); } /* check if form was submitted */ if (isset($_POST['Submit'])){ $error_message = ""; /* This is the directory where images will be saved */ $target = "/home/users/web/b109/ipg.removalspacecom/images/COMPANIES/"; $target = $target . basename( $_FILES['upload']['name']); /* include validation script */ include ('php only scripts/validation.php'); $uploadDir = 'images/COMPANIES'; /* main picture folder */ $max_height = 450; /* largest height you allowed; 0 means any */ $max_width = 450; /* largest width you allowed; 0 means any */ $max_file = 2000000; /* set the max file size in bytes */ $image_overwrite = 1; /* 0 means overwite; 1 means new name */ /* add or delete allowed image types */ $allowed_type01 = array( "image/gif", "image/pjpeg", "image/jpeg", "image/png", "image/x-png", "image/jpg"); $do_thumb = 1; /* 1 make thumbnails; 0 means do NOT make */ $thumbDir = "/images/thumbs"; /* thumbnail folder */ $thumb_prefix = ""; /* prefix for thumbnails */ $thumb_width = 90; /* max thumb width */ $thumb_height = 70; // max thumb height //Writes the photo to the server if(move_uploaded_file($_FILES['upload']['tmp_name'], $target)) { /* HERE IS WHERE WE WILL DO THE ACTUAL RESIZING */ /* THESE SIX PARAMETERS MAY BE CHANGED TO SUIT YOUR NEEDS */ $upload = $_FILES['upload']['name']; $o_path ="images/COMPANIES/"; $s_path = "images/thumbs/"; $file = $upload; $save = $file; $t_w = 200; $t_h = 150; /* DO NOT CHANGE THIS NEXT LINE */ Resize_Image($save,$file,$t_w,$t_h,$s_path,$o_path); }else{ //Gives and error if its not $error_message .= "Sorry, there was a problem uploading your file."; } /* PREPARE DATA FOR INSERTION INTO TABLE */ //Writes the information to the database if(strlen(trim($error_message)) <1){ $salt = createsalt(); $password = trim($_POST['password']); $hash = hash('sha256', $salt, $password); $approved = 0; $company_name = mysql_real_escape_string(trim($_POST['company_name'])); $website = mysql_real_escape_string(trim($_POST['website'])); $contact_name = mysql_real_escape_string(trim($_POST['contact_name'])); $location = mysql_real_escape_string(trim($_POST['location'])); $postcode = mysql_real_escape_string(trim($_POST['postcode'])); $street1 = mysql_real_escape_string(trim($_POST['street1'])); $street2 = mysql_real_escape_string(trim($_POST['street2'])); $city = mysql_real_escape_string(trim($_POST['city'])); $phone = mysql_real_escape_string(trim($_POST['phone'])); $email = mysql_real_escape_string(trim($_POST['email'])); $premiumuser_description = mysql_real_escape_string(trim($_POST['premiumuser_description'])); $salt = mysql_real_escape_string($salt); $upload = mysql_real_escape_string($upload); $query ="INSERT INTO `companies` (company_name, what_services, website, contact_name, location, postcode, street1, street2, city, phone, email, premiumuser_description, password, salt, approved, upload) VALUES ('$company_name', '$what_services', '$website', '$contact_name', '$location', '$postcode', '$street1', '$street2', '$city', '$phone', '$email', '$premiumuser_description', '$password', '$salt', '$approved', '$upload')"; $result = mysql_query($query) or die(mysql_error()); /* at this point we can send an email to the admin as well as the user. DO NOT send the user's password to ANYONE!!!! */ } }//if (isset($_POST['submit'])) ?> <!DOCTYPE html> <head> <title>Login/Sign Up | Removalspace.com</title> <style type="text/css"> <!-- body { background-image: url(styles/downloaded%20styles/todo/todo/images/bg.png); } --> </style> <link href="styles/downloaded styles/todo/todo/css/style.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" href="styles/downloaded styles/todo/todo/css/style9.css" /> <link rel="stylesheet" type="text/css" href="styles/downloaded styles/todo/todo/css/demo.css" /> <link href='http://fonts.googleapis.com/css?family=Terminal+Dosis' rel='stylesheet' type='text/css' /> <style type="text/css"> <!-- .Stile1 {color: #333333} --> </style> </head> <body> <!--start container --> <div id="container"> <header> <nav> <div id="logo"><a href="index.php"><img src="images/header2.png" alt="Logo here" width="219" height="161" /></a> </div> <div id="search-top"> <form method="post" action="search-results.php"> <input type="text" onFocus="if(this.value=='Search')this.value='';" onBlur="if(this.value=='')this.value='Search';" value="Search" id="search-field"/> <input type="submit" value="" id="search-btn"/> </form> </div> <div id="nav_social"><a href="http://www.facebook.com/pages/Removalspace/181434181939226"><img src="styles/downloaded styles/todo/todo/images/facebook_32.png" alt="Become a fan" width="32" height="32" /></a><a href="#"><img src="styles/downloaded styles/todo/todo/images/twitter_32.png" alt="Follows on Twitter" /></a><a href="#"><img src="styles/downloaded styles/todo/todo/images/linkedin_32.png" alt="Linked in" /></a><a href="contact.php"><img src="styles/downloaded styles/todo/todo/images/email_32.png" alt="Contact" width="32" height="32" /></a> </div> </nav> </header> <p><a href="removals.php">Search Removals</a></p> <p><a href="storage.php">Search Storage</a></p> <p><a href="about.php">About</a></p> <p><a href="contact.php">Contact</a></p> <div class="content"> <!--star main --> <main></main> <!--end main --> <!--start middle --> <middle> <div class="section_slogan"><span class="cursive"> <html> <body> <?php if (!empty($error_message)){ echo $error_message; } ?> <form action="register00.php" method="post" enctype="multipart/form-data" class="cursive"> <table width="316" border="0"> <tr><td colspan=2><h1>Register/Sign Up</h1></td></tr> <tr><td>Company Name:</td><td> <p> <input name="company_name" type="text" id="company_name" value="<?php if (isset($_POST['company_name'])){ echo $_POST['company_name']; } ?>" /> </p></td></tr> <tr><td>Select the service you offer:</td><td><p> </p> <p> <input type="radio" name="what_services" value="R" <?php echo (isset($_POST['what_services']) && $_POST['what_services']=="R" ? 'checked="checked"' : '') ?> /> </p> <p>Removal<br> <input type="radio" name="what_services" value="S" <?php echo (isset($_POST['what_services']) && $_POST['what_services']=="S" ? 'checked="checked"' : '') ?> /> </p> <p>Storage<br> <input type="radio" name="what_services" value="B" <?php echo (isset($_POST['what_services']) && $_POST['what_services']=="B" ? 'checked="checked"' : '') ?> /> </p> <p>Both<br> </p></td></tr> <tr><td>Website:</td><td> <input name="website" type="text" class="style7" id="website" value="<?php if (isset($_POST['website'])){ echo $_POST['website']; } ?>" /> </td></tr> <tr><td>Contact Name:</td><td> <input name="contact_name" type="text" id="contact_name" value="<?php if (isset($_POST['contact_name'])){ echo $_POST['contact_name']; } ?>" /> </td></tr> <tr><td>Contact Number:</td><td> <input name="phone" type="number" id="phone" value="<?php if (isset($_POST['phone'])){ echo $_POST['phone']; }else{ echo "incl. area code";} ?>" /> </td></tr> <tr><td>Address line 1:</td><td> <input name="street1" type="text" id="street1" value="<?php if (isset($_POST['street1'])){ echo $_POST['street1']; } ?>" /> </td></tr> <tr><td>Address line 2:</td><td> <input name="street2" type="text" id="street2" value="<?php if (isset($_POST['street2'])){ echo $_POST['street2']; } ?>" /> </td></tr> <tr><td>Area:</td><td> <input name="location" type="text" id="location" value="<?php if (isset($_POST['location'])){ echo $_POST['location']; } ?>" /> </td></tr> <tr><td>City:</td><td> <input name="city" type="text" id="city" value="<?php if (isset($_POST['city'])){ echo $_POST['city']; } ?>" /> </td></tr> <tr><td>Postcode:</td><td> <input name="postcode" type="text" id="postcode" value="<?php if (isset($_POST['postcode'])){ echo $_POST['postcode']; } ?>" /> </td></tr> <tr><td>Username:</td><td> <input name="username" type="text" id="username" value="<?php if (isset($_POST['username'])){ echo $_POST['username']; } ?>" /> </td></tr> <tr><td>Password:</td><td> <input name="password" type="password" class="style7" id="password" value="<?php if (isset($_POST['password'])){ echo $_POST['password']; } ?>" /> </td></tr> <tr><td>Email:</td><td> <input name="email" type="text" class="style7" id="email" value="<?php if (isset($_POST['email'])){ echo $_POST['email']; } ?>" /> </td></tr> <tr><td>Company Logo:</td><td> <input name="upload" type="file" class="style7" id="upload"> </td></tr> <tr><td>Company Description:</td><td> <textarea rows="20" cols="50" name="premiumuser_description" id="premiumuser_description"><?php if (isset($_POST['premiumuser_description'])){ echo "{$_POST['premiumuser_description']}"; } ?></textarea> </td></tr> <tr><td> <input name="Submit" type="submit" value="Register" /> </td></tr> </table> </form> </span></div> </middle> </div> <!--end middle --> <!--start footer --> <footer> <div id="footer"></div> </footer> <!--end footer --> </div> <!--end container --> <!-- Free template distributed by http://freehtml5templates.com --> </body> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> </html> Quote Link to comment Share on other sites More sharing options...
andy_b_1502 Posted April 26, 2012 Author Share Posted April 26, 2012 New code, i still cant use my form online? any reason why? Thanks <?PHP session_start(); include('php only scripts/db.php'); include('php only scripts/resize.php'); ?> <!DOCTYPE html> <head> <title>Login/Sign Up | Removalspace.com</title> <style type="text/css"> <!-- body { background-image: url(styles/downloaded%20styles/todo/todo/images/bg.png); } --> </style> <link href="styles/downloaded styles/todo/todo/css/style.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" type="text/css" href="styles/downloaded styles/todo/todo/css/style9.css" /> <link rel="stylesheet" type="text/css" href="styles/downloaded styles/todo/todo/css/demo.css" /> <link href='http://fonts.googleapis.com/css?family=Terminal+Dosis' rel='stylesheet' type='text/css' /> <style type="text/css"> <!-- .Stile1 {color: #333333} --> </style> </head> <body> <!--start container --> <div id="container"> <header> <nav> <div id="logo"><a href="index.php"><img src="images/header2.png" alt="Logo here" width="219" height="161" /></a> </div> <div id="search-top"> <form method="post" action="search-results.php"> <input type="text" onFocus="if(this.value=='Search')this.value='';" onBlur="if(this.value=='')this.value='Search';" value="Search" id="search-field"/> <input type="submit" value="" id="search-btn"/> </form> </div> <div id="nav_social"><a href="http://www.facebook.com/pages/Removalspace/181434181939226"><img src="styles/downloaded styles/todo/todo/images/facebook_32.png" alt="Become a fan" width="32" height="32" /></a><a href="#"><img src="styles/downloaded styles/todo/todo/images/twitter_32.png" alt="Follows on Twitter" /></a><a href="#"><img src="styles/downloaded styles/todo/todo/images/linkedin_32.png" alt="Linked in" /></a><a href="contact.php"><img src="styles/downloaded styles/todo/todo/images/email_32.png" alt="Contact" width="32" height="32" /></a> </div> </nav> </header> <p><a href="removals.php">Search Removals</a></p> <p><a href="storage.php">Search Storage</a></p> <p><a href="about.php">About</a></p> <p><a href="contact.php">Contact</a></p> <div class="content"> <!--star main --> <main></main> <!--end main --> <!--start middle --> <middle> <div class="section_slogan"><span class="cursive"> <?PHP /* create an email validation function */ function validateEmailAddress($email) { return filter_var($email, FILTER_VALIDATE_EMAIL) && preg_match('/@.+\./', $email); } /* FUNCTION TO CREATE SALT */ function createSalt() { $string = md5(uniqid(rand(), true)); return substr($string, 0, 3); } /* check if form was submitted */ if (isset($_POST['Submit'])){ $error_message = ""; /* This is the directory where images will be saved */ $target = "/home/users/web/b109/ipg.removalspacecom/images/COMPANIES/"; $target = $target . basename( $_FILES['upload']['name']); /* include validation script */ include ('php only scripts/validation.php'); $uploadDir = 'images/COMPANIES'; /* main picture folder */ $max_height = 450; /* largest height you allowed; 0 means any */ $max_width = 450; /* largest width you allowed; 0 means any */ $max_file = 2000000; /* set the max file size in bytes */ $image_overwrite = 1; /* 0 means overwite; 1 means new name */ /* add or delete allowed image types */ $allowed_type01 = array( "image/gif", "image/pjpeg", "image/jpeg", "image/png", "image/x-png", "image/jpg"); $do_thumb = 1; /* 1 make thumbnails; 0 means do NOT make */ $thumbDir = "/images/thumbs"; /* thumbnail folder */ $thumb_prefix = ""; /* prefix for thumbnails */ $thumb_width = 90; /* max thumb width */ $thumb_height = 70; // max thumb height //Writes the photo to the server if(move_uploaded_file($_FILES['upload']['tmp_name'], $target)) { /* HERE IS WHERE WE WILL DO THE ACTUAL RESIZING */ /* THESE SIX PARAMETERS MAY BE CHANGED TO SUIT YOUR NEEDS */ $upload = $_FILES['upload']['name']; $o_path ="images/COMPANIES/"; $s_path = "images/thumbs/"; $file = $upload; $save = $file; $t_w = 200; $t_h = 150; /* DO NOT CHANGE THIS NEXT LINE */ Resize_Image($save,$file,$t_w,$t_h,$s_path,$o_path); }else{ //Gives and error if its not $error_message .= "Sorry, there was a problem uploading your file."; } /* PREPARE DATA FOR INSERTION INTO TABLE */ //Writes the information to the database if(strlen(trim($error_message)) <1){ $salt = createsalt(); $password = trim($_POST['password']); $hash = hash('sha256', $salt, $password); $approved = 0; $company_name = mysql_real_escape_string(trim($_POST['company_name'])); $website = mysql_real_escape_string(trim($_POST['website'])); $contact_name = mysql_real_escape_string(trim($_POST['contact_name'])); $location = mysql_real_escape_string(trim($_POST['location'])); $postcode = mysql_real_escape_string(trim($_POST['postcode'])); $street1 = mysql_real_escape_string(trim($_POST['street1'])); $street2 = mysql_real_escape_string(trim($_POST['street2'])); $city = mysql_real_escape_string(trim($_POST['city'])); $phone = mysql_real_escape_string(trim($_POST['phone'])); $email = mysql_real_escape_string(trim($_POST['email'])); $premiumuser_description = mysql_real_escape_string(trim($_POST['premiumuser_description'])); $salt = mysql_real_escape_string($salt); $upload = mysql_real_escape_string($upload); $query ="INSERT INTO `companies` (company_name, what_services, website, contact_name, location, postcode, street1, street2, city, phone, email, premiumuser_description, password, salt, approved, upload) VALUES ('$company_name', '$what_services', '$website', '$contact_name', '$location', '$postcode', '$street1', '$street2', '$city', '$phone', '$email', '$premiumuser_description', '$password', '$salt', '$approved', '$upload')"; $result = mysql_query($query) or die(mysql_error()); /* at this point we can send an email to the admin as well as the user. DO NOT send the user's password to ANYONE!!!! */ } }//if (isset($_POST['submit'])) ?> <?php if (!empty($error_message)){ echo $error_message; } ?> <form action="register00.php" method="post" enctype="multipart/form-data" class="cursive"> <table width="316" border="0"> <tr><td colspan=2><h1>Register/Sign Up</h1></td></tr> <tr><td>Company Name:</td><td> <p> <input name="company_name" type="text" id="company_name" value="<?php if (isset($_POST['company_name'])){ echo $_POST['company_name']; } ?>" /> </p></td></tr> <tr><td>Select the service you offer:</td><td><p> <p> <input type="radio" name="what_services" value="R" <?php echo (isset($_POST['what_services']) && $_POST['what_services']=="R" ? 'checked="checked"' : '') ?> /> </p> <p>Removal<br> <input type="radio" name="what_services" value="S" <?php echo (isset($_POST['what_services']) && $_POST['what_services']=="S" ? 'checked="checked"' : '') ?> /> </p> <p>Storage<br> <input type="radio" name="what_services" value="B" <?php echo (isset($_POST['what_services']) && $_POST['what_services']=="B" ? 'checked="checked"' : '') ?> /> </p></td></tr> <tr><td>Website:</td><td> <input name="website" type="text" class="style7" id="website" value="<?php if (isset($_POST['website'])){ echo $_POST['website']; } ?>" /> </td></tr> <tr><td>Contact Name:</td><td> <input name="contact_name" type="text" id="contact_name" value="<?php if (isset($_POST['contact_name'])){ echo $_POST['contact_name']; } ?>" /> </td></tr> <tr><td>Contact Number:</td><td> <input name="phone" type="number" id="phone" value="<?php if (isset($_POST['phone'])){ echo $_POST['phone']; }else{ echo "incl. area code";} ?>" /> </td></tr> <tr><td>Address line 1:</td><td> <input name="street1" type="text" id="street1" value="<?php if (isset($_POST['street1'])){ echo $_POST['street1']; } ?>" /> </td></tr> <tr><td>Address line 2:</td><td> <input name="street2" type="text" id="street2" value="<?php if (isset($_POST['street2'])){ echo $_POST['street2']; } ?>" /> </td></tr> <tr><td>Area:</td><td> <input name="location" type="text" id="location" value="<?php if (isset($_POST['location'])){ echo $_POST['location']; } ?>" /> </td></tr> <tr><td>City:</td><td> <input name="city" type="text" id="city" value="<?php if (isset($_POST['city'])){ echo $_POST['city']; } ?>" /> </td></tr> <tr><td>Postcode:</td><td> <input name="postcode" type="text" id="postcode" value="<?php if (isset($_POST['postcode'])){ echo $_POST['postcode']; } ?>" /> </td></tr> <tr><td>Username:</td><td> <input name="username" type="text" id="username" value="<?php if (isset($_POST['username'])){ echo $_POST['username']; } ?>" /> </td></tr> <tr><td>Password:</td><td> <input name="password" type="password" class="style7" id="password" value="<?php if (isset($_POST['password'])){ echo $_POST['password']; } ?>" /> </td></tr> <tr><td>Email:</td><td> <input name="email" type="text" class="style7" id="email" value="<?php if (isset($_POST['email'])){ echo $_POST['email']; } ?>" /> </td></tr> <tr><td>Company Logo:</td><td> <input name="upload" type="file" class="style7" id="upload"> </td></tr> <tr><td>Company Description:</td><td> <textarea rows="20" cols="50" name="premiumuser_description" id="premiumuser_description"><?php if (isset($_POST['premiumuser_description'])){ echo "{$_POST['premiumuser_description']}"; } ?></textarea> </td></tr> <tr><td> <input name="Submit" type="submit" value="Register" /> </td></tr> </table> </form> </span></div> </middle> </div> <!--end middle --> <!--start footer --> <footer> <div id="footer"></div> </footer> <!--end footer --> </div> <!--end container --> <!-- Free template distributed by http://freehtml5templates.com --> </body> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> </html> Quote Link to comment Share on other sites More sharing options...
andy_b_1502 Posted April 26, 2012 Author Share Posted April 26, 2012 forgot heres the link: www.removalspace.com/register00.php Quote Link to comment Share on other sites More sharing options...
Drummin Posted April 26, 2012 Share Posted April 26, 2012 The only thing I can see that should be changed is directories with spaces in the name. downloaded styles I'm not sure what included files contain or how they might be affecting the page. Even though I don't have your included pages, the form loads and selected values are posted and returned to the form. Quote Link to comment 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.