Jump to content

bbaker

Members
  • Posts

    127
  • Joined

  • Last visited

Everything posted by bbaker

  1. agreeing with Pikachu on this one.
  2. are you just trying to automatically get urls formatted?
  3. like blmg911 said.....these are CSS questions with the shark expanding below the thumbnails.....for "pika_subdiv" set a height & add overflow: hidden; in the CSS. play with the CSS values. I went to your sight & modified it locally using Firebug & changing the widths in the CSS seem to work just fine.
  4. http://us.php.net/manual/en/function.mail.php
  5. bbaker

    php help

    $username = $_POST['nickname']; echo $username;
  6. just make it $MAIL_to2 = $_POST['bookers_email'];
  7. instead of taking care of the duplicates in the query....let PHP do the work for you. Put all the university info in 1 array, then use array_unique(), to remove the duplicates $result = mysql_query("SELECT university_1, university_2, university_3 FROM stores WHERE status = 1 AND approved = 1"); while($row = mysql_fetch_array($result)) { $u[] = stripslashes($row['university_1']); // ALL IN $u[] = stripslashes($row['university_2']); // ONE $u[] = stripslashes($row['university_3']); // ARRAY $u } $newU = array_unique($u); // remove duplicates from array foreach($newU as $opts){ print '<option>'.$opts.'</option>'; }
  8. be sure to trim() your data before it gets saved into the db
  9. you code is forcing a download....to display an image, just use an img tag....no need to us readfile at all
  10. looks like you just have your syntax incorrect....try this: if ($existcat !== 'None'){ $queryreg = mysql_query("INSERT INTO articles (article_cat) VALUES ('$existcat')"); }else{ if ($existcat == 'None'){ $queryreg = mysql_query("INSERT INTO articles (article_cat) VALUES ('$newcat')"); } }
  11. <?php $sql = "SELECT DISTINCT(article_section) FROM tablename"; $query = mysql_query($sql); if(mysql_num_rows($query) > 0){?> <select name="categories"> <?php while($r = mysql_fetch_array($query)){ echo '<option value=" ' .$r['article_section'] . '">' . $r['article_section'] . '</option>'; } ?> </select> <?php } ?>
  12. Why are you sending it via url (get)? You can/should use post method. Using get can cause issues with the url being too long & is likely the issue with line breaks.
  13. problem is that he doesn't have control over the naming scheme, so I was trying to help out with what he has to work with....that's why I suggested urlencode "Management System Documentation/Shipping & Receiving/Receiving" is what I meant needs to have urlencode. So where ever that is coming from in the first place, needs to be sent through the urlencode function. So the URL would actually look like: index.php?page=Management+System+Documentation%2FShipping+%26+Receiving%2FReceiving
  14. oh....wait.... where is the page=Management System Documentation/Shipping & Receiving/Receiving coming from. THAT is what needs the urlencode on it.
  15. http://us.php.net/manual/en/function.urlencode.php ...maybe? Not sure how it handles &'s $page = 'index/'.urlencode($page).'/struct.php
  16. do you mean that you have a drop down list, then once you select an option from the list you want to populate the next input field with data depending on the selected option? You'll need javascript for that.
  17. http://jqueryui.com/demos/sortable/
  18. all you need to do to accomplish that is to add "main.php" to the action attribute in your form tag.
  19. instead of using 'html' dataType, I'd use 'json' & change things around a little bit. here's the code I'd use: register.html <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <link href="css/styles.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="lib/jquery-1.4.min(Production).js"></script> <script src="js/jqueryscript.js" type="text/javascript"></script> </head> <body> <div id="error"></div> <div id="actionForm"> <p>Fill following form to Join us Now</p> <form id="form1" name="form1" method="post" action=""> <div> <label>First Name:</label> <input type="text" name="firstname" id="firstname" /> </div> <div> <label>Last Name:</label> <input type="text" name="lastname" id="lastname" /> </div> <div> <label>Your Email:</label> <input type="text" name="email" id="email" /> </div> <div> <label>Password:</label> <input type="password" name="password" id="password" /> </div> <div> <label>Repeat Password:</label> <input type="password" name="repeatpassword" id="repeatpassword" /> </div> <div> <label>I am:</label> <select name="sex" id="sex"> <option value="sex">Select Sex</option> <option value="m">Male</option> <option value="f">Female</option> </select> </div> <div> <label>Birthday:</label> <select name="month" id="month"> <option>Month</option> <option value="jan">Jan</option> <option value="feb">Feb</option> <option value="mar">Mar</option> <option value="apr">Apr</option> <option value="may">May</option> <option value="jun">Jun</option> <option value="jul">Jul</option> <option value="aug">Aug</option> <option value="sep">Sep</option> <option value="oct">Oct</option> <option value="nov">Nov</option> <option value="dec">Dec</option> </select> <select name="day" id="day"> <option>Day</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> <option value="11">11</option> <option value="12">12</option> <option value="13">13</option> <option value="14">14</option> <option value="15">15</option> <option value="16">16</option> <option value="17">17</option> <option value="18">18</option> <option value="19">19</option> <option value="20">20</option> <option value="21">21</option> <option value="22">22</option> <option value="23">23</option> <option value="24">24</option> <option value="25">25</option> <option value="26">26</option> <option value="27">27</option> <option value="28">28</option> <option value="29">29</option> <option value="30">30</option> <option value="31">31</option> </select> <select name="year" id="year"> <option selected="selected">Year</option> <option value="1900">1900</option> <option value="1901">1901</option> <option value="1980">1980</option> <option value="1987">1987</option> <option value="1995">1995</option> <option value="2000">2000</option> </select> </div> <div class="actions"> <input type="button" value="Join Now" onclick="register()" /> </div> </form> </div> </body> </html> Notice....I removed the name & id attributes from the submit button. I read somewhere a while back that there is an issue with using one of those with a javascript submit (which you'll see that I used in jqueryscript.js register.php <?php $firstname = strip_tags($_POST['firstname']); $lastname = strip_tags($_POST['lastname']); $email = strip_tags($_POST['email']); $password = strip_tags($_POST['password']); $repeatpassword = strip_tags($_POST['repeatpassword']); $sex = strip_tags($_POST['sex']); $month = strip_tags($_POST['month']); $day = strip_tags($_POST['day']); $year = strip_tags($_POST['year']); $dob = date($year."-".$month."-".$day); /* echo $firstname.'<br>'; echo $lastname.'<br>'; echo $email.'<br>'; echo $password.'<br>'; echo $repeatpassword.'<br>'; echo $sex.'<br>'; echo $month.'<br>'; echo $day.'<br>'; echo $year.'<br>'; */ $error = 'yes'; if($firstname&&$lastname){ if($email) { if (ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { $connect = mysql_connect("localhost","user","user"); mysql_select_db("facebook"); $emailcheck = mysql_query("SELECT email FROM users WHERE email='$email'"); $count = mysql_num_rows($emailcheck); if($count == 0){ if($sex=='m'||$sex=='f') { if($password&&$repeatpassword) { if($password==$repeatpassword) { if(strlen($password)<25 && strlen($password)>=6) { $password = md5($password); //echo $password; $reg = mysql_query("INSERT INTO users VALUES ('','$email','$password')"); $_SESSION['email'] = $email; $error = 'no'; $msg = "Welcome ".$firstname." ".$lastname.", You are now registered."; //header("Location: /main.php"); } else $msg = "Length of password must be between 6 and 25 characters."; } else $msg = "Password and Repeat password do not match!"; } else $msg = "Please fill in password and repeat password fields!"; } else $msg = "Pease select your gender!"; } else $msg = "user with this email address already exist! Please choose another email."; } else $msg = "Invalid email address!"; } else $msg = "Please fill in your email address!"; } else $msg = "Please fill in firstname and lastname."; $JSON_response = '{'; $JSON_response .= '"error": "'.addslashes($error).'",'; $JSON_response .= '"fieldErrors": "'.$msg.'"'; $JSON_response .= '}'; echo $JSON_response; ?> the line $msg = "Welcome ".$firstname." ".$lastname.", You are now registered."; is not really needed. Might handle this on the page you're submitting to. Though I didn't change the code here, it's difficult to understand where you're submitting to. The code you have enters the email & password into a db, but doesn't store anything else....so I'm assuming the page that you intend to submit to will handle the rest. You'll notice that instead of echoing the error message, I created a $msg variable to use later in the code..... The $JSON_responce echos the JSON formatted response from the ajax submit. jqueryscript.js function sign() { $('#container').load('login.html'); } function joinNow() { $('#container').load('register.html'); } function register() { var url = 'register.php'; var queryString = $('#form1').serialize(); $.ajax( { type: 'POST', url: url, data: queryString, dataType: 'json', success: function(resultData){ if(resultData.error=='no'){ $('#error').fadeOut('slow'); $('#form1').submit(); } else { $('#error').html(resultData.fieldErrors).fadeIn('slow'); } } }); } serialize is your friend for submit forms with ajax. You'll notice a lot less code here. I changes the dataType to 'json' & added a function in the success setting. If the "error" part of th JSON response == 'no', it submits the form (though there's no file set in the action attribute of your form). Else, it shows the field Error. Hope this helps
  20. I think his code was cut off when he pasted it..... Are any of the fields in your db "unique"? If you're not validating for another field that is set to unique, then you may have a problem with getting another record in the db
  21. session_start(); needs to be on EVERY pages where you are setting or retrieving session variables
  22. <?php $sql = mysql_fetch_array(mysql_query("SELECT COUNT(user) as numusers, MIN(time) as oldest FROM last_visitors")); if ($sql['numusers'] == 10){ mysql_query("DELETE FROM last_visitors WHERE time = '$sql[oldest]'") or die(mysql_error()); } $sql = mysql_query("INSERT INTO last_visitors VALUES ('$guestname','$visitorname','$time')") or die(mysql_error()); ?>
  23. Here's what I do (instead of using js history -1)....of course this is very basic & there's really no input security in this script that I'm about to share. <?php ## FORM function form(){ foreach ($_POST as $key => $value){ // get form values (if it has been filled out already) $$key = trim($value); // sets input "names" as $email, $subject...etc } //echo the form echo' <form action="contact.php" method="post"> <p>* = required</p> <p>* Email: <input type="text" name="email" size="38" value="'.$email.'" /><br /> Subject: <input type="text" name="subject" size="38" value="'.$subject.'" /><br /> * Message: <textarea name="message" class="medlength" rows="5" cols="40">'.$message.'</textarea><br /> <input type="submit" name="submit" value="Submit" /></p> </form>'; } ## END FORM if (!isset($_POST['submit'])){ //if form has NOT been submitted form(); // show the form! } else { foreach ($_POST as $key => $value){ // get form values $$key = strlen($key) > 1 ? trim($value) : null; // check that values are not empty, if so, make them NULL } if($email && $message){ // if $email & $message are not null....GO! echo "SENT!<br /> Email: $email<br /> Subject: $subject<br /> Message: $message "; } else{ // if $email or $message are empty....HALT! echo "ERROR! - Please fill in ALL requied fields"; form(); // show the form again....any typed information will still be there. } } ?>
  24. signoff_status = '" . $_POST['signoff_status'] . "'' There's an extra single quote in the line above
×
×
  • 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.