Forms and PHP
Topics
Hi guys, I'm currently in the process of creating a login form. I'm using PHP to check a simple text file called 'users.txt' for the username and password which has been entered in the form. If the username and password are NOT in the 'users.txt' file, it will create them on a new line. Like so: Users.txt Code: [Select] ExampleUser,ExamplePass\n Marc,password Craig,password John,password Once I try to log into an account which is NOT there, it will create an account underneath. So if I try to log in with username as "Matthew" and password as "password" it will show like so: Code: [Select] ExampleUser,ExamplePass\n Marc,password Craig,password John,password Matthew,password Hoping this makes sense so far, all of the above works. However when I click back, to go back onto the login form, I try to log in with one of the usernames/passwords in the 'users.txt' file, and it will create the exact same user on a new line, so I have 2 of the same usernames/passwords. What I want it to do it, if the username is in the 'users.txt' file, for it to display a message saying "Congratulations you're logged in". Here is the code for the PHP login page. P4 LoginScriptFile.php Code: [Select] <?php //This checks for required fields from the form. if ((!$_POST[username]) || (!$_POST[password])) { header("Location: P4 LoginForm.php"); exit; } //This reads values from the form. $form_user = $_POST[username]; $form_password = $_POST[password]; $flag = FALSE; $filename = "users.txt"; $fp = fopen( $filename, "r" ) or die ("Couldn't open $filename"); while ( ! feof( $fp ) ) { $line = fgets( $fp); $user = strtok($line, ","); //Username $password = strtok(","); //Password if (($form_user == $user) && ($form_password == $password)) { $flag = TRUE; } } if ($flag) { echo "<br>Congratulations, you're logged in"; } else{ $filename = "users.txt"; $updateuser = $_POST ['username']; $updatepass = $_POST ['password']; $fp = fopen( $filename, "a" ) or die("Couldn't open $filename"); fwrite( $fp, "$updateuser,$updatepass\n") or die ("Couldn't write values to your file!"); fclose( $fp ); echo "<br>An account has been created for you!"; } ?> I think what I need is to read the file once the new user has been created. Any help would be greatly appreciated. Thanks in advance for any help. gixxx hi, I am displaying mysql data in a table form using php. The first attached pic shows how is it looking with the current code. As you can see there are heading on the left and top of the table. So user can make booking on a specific day (heading is on the top for days) and for specific duration of time(headings are on the left). As in first pic, there has been a booking on Wed at 10 o clock, but the problem is, it is displaying duration just for half an hour. As this duration is from 10 o clock to 11 o clock. So what I want to do is in the second pic. Please view the second pic. In the second pic I want to display the highlighted area in blie because all this time is booked or reserved. Here is my current code. Code: [Select] <?php require("dbconnect/dbconnect.php"); $building = $_POST['building']; $block = $_POST['block']; $d_m = $_POST['d_m']; $choose_one = $_POST['choose_one']; function get_data($table, $choose_one) { $bool = 1; $get_days = mysql_query("SELECT * FROM days"); $get_times = mysql_query("SELECT * FROM time"); $days = mysql_num_rows($get_days); //$row_day_id = mysql_fetch_assoc($get_days); //$day_id_db = $row['dayid']; echo "<table cellspacing='0' border='0' cellpadding='5'> <tr> <th scope='col' width='100'></th>"; while($row_time = mysql_fetch_assoc($get_times)) { while($bool <= $days) { $row_days = mysql_fetch_assoc($get_days); $dayname = $row_days['days']; echo " <th scope='col' width='100'>$dayname</th> "; $bool++; } $day_id = 1; $timeid = $row_time['timeid']; $time = $row_time['time']; echo " <tr> <th scope='row' width='100' height='50'>$time</th>"; while($day_id <= $days) { $get = mysql_query(" SELECT * FROM $table WHERE dayid='$day_id' AND timeid_from='$timeid' AND d_m='$choose_one' ") or die(mysql_error()); if(mysql_numrows($get) > 0) { $row = mysql_fetch_assoc($get); $block = $row['block']; $apt = $row['apartment_no']; $room = $row['room_no']; $d_m = $row['d_m']; $timeid_to = $row['timeid_to']; echo " <td width='110' height='50' bgcolor='lightblue'> <b>Block:</b> $block<br /> <b>Apartment:</b> $apt<br /> <b>Room:</b> $room </td> "; //echo "</tr>"; } else { echo " <td width='110' height='50' bgcolor='green'></td> "; } $day_id++; } //end of second inner while loop echo "</tr>"; } //end of outer while loop echo "</table>"; } if($building) { if($block) { if($d_m) { if($choose_one) { if($building == 'mik') { if($block == 'Block A' || $block == 'Block B') { get_data('reserve_mik_ab', $choose_one); } else if ($block == 'Block C' || $block == 'Block D') { get_data('reserve_mik_cd', $choose_one); } } if($building == 'p') { get_data('reserve_p',$choose_one); } } else { echo "Choose one!"; } } } } ?> Please help! Hi, I have a contact for which I wish to send to multiple recipients as a BCC, but I cannot work it out. I can add them as recipients, but they are not hidden in the email. This is what I have: if(isset($_POST['submit'])){ $name=$_POST['name']; $year=$_POST['year']; $email=$_POST['email']; $subject = 'Hello Admin !'; $message="Name : $name <br> Email : $email <br> Phone : $phone <br> Year : $year"; $recipients ="me@me.com, me2@me2.com"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $subject="New contact details"; $headers .= 'From: TEST<test@test.com>' . "\r\n"; mail($recipients ,$subject,$message,$headers); header("Location: thankyou.php"); Any ideas what I should do? Thanks I'm just learning about PHP and I'm diving in head first by attempting to modify our web site's contact form. I'm wishing to stop the form from erasing previously entered values upon "failed" data validation. It's of course going to be annoying to our visitors if their hardworked entries disappear just because they left out a name or entered an illegal email address. I regret that some potential solutions found on this forum and other locations on Google didn't seem to help on my page. As you can see, the validation is done with PHP's version of if-elseif-else. Later I'll be adding a reCAPTCHA and I hope that whatever I learn here might be useful for the potentially same problem when I am adding the CAPTCHA. The actual contact form is at http://www.woofwoofwoof.org/contact/index.php. Thank you in advance for your taking the time to help me what originally appeared to be a simple problem. I have read the rules and I hope I've followed the rules -- please let me know if I committed any sins of omission or commission. Now, for your Sunday reading pleasure, here's the code: CODE STARTS HERE ==================================== <?php include("../common/docType.php"); ?> <?php include("../common/htmlOpen.php"); ?> <head> <title><?php include("../common/titleBar.php"); ?> - Contact us!</title> <meta name="description" content="Call or email us with questions or orders."> <meta name="keywords" content="Barking Dog Chocolatiers, Charlotte NC, chocolate, contact us, telephone, email, e-mail"> <meta name="geo.placename" content="Charlotte, North Carolina"> <meta name="geo.region" content="US-NC"> <meta name="author" content="Joal Fischer"> <meta name="verify-v1" content="1aqZs7xrrfI3lp1RaWDkHHjY9UQZIbq2z/mIVdFeXiI=" /> <?php include("../common/headInclude.php"); ?> <script src="../common/common.js" type="text/javascript"></script> <link rel="Stylesheet" href="../css/contact.css" /> </head> <?php // Success/Fail message $msg = ""; $brisket = ""; // Target Email $targetEmail = "barkingdog@bellsouth.net"; // Process Submissions if(isset($_POST['submitted'])) { if($_POST['submitted']) { // process form. $guestName = $_POST['guestName']; $cityState = $_POST['cityState']; $emailAddress = $_POST['emailAddress']; $phone = $_POST['phone']; $msgSubject = "Barking Dog Chocolatiers Inquiry"; $msgContent = "FROM: $guestName\n"; $msgContent .= "City/State: $cityState\n"; $msgContent .= "Phone & time to call: $phone\n"; $msgContent .= "\nInquiry:\n"; $msgContent .= stripslashes($_POST['msgContent']); // Trial if then else reversed from Dan's original allowing maybe multiple tests in sequence -- in action if($guestName == "") { $keepvar = "1"; $msg = "<p style='color: red; font-weight: bold; font-size: 14px; margin: 12px 0px 0px 0px;'>Please enter a name!</p>"; } elseif($emailAddress == "") { $msg = "<p style='color: red; font-weight: bold; font-size: 14px; margin: 12px 0px 0px 0px;'>Please enter a valid email address!</p>"; } else { mail($targetEmail, $msgSubject, $msgContent, "From: $guestName <$emailAddress>\nX-Mailer:PHP/" . phpversion()); $msg = "<p style='color: darkgreen; font-weight: bold; font-size: 14px; margin: 12px 0px 0px 0px;'>Thank you! Your message has been sent.</p>"; $brisket = "<img src='../images/Brisket180x180web.jpg' width='180px' height='180px' alt='Brisket Says Hi' />"; } // Original if then else all commented out // if($emailAddress != "") { // mail($targetEmail, $msgSubject, $msgContent, "From: $guestName <$emailAddress>\nX-Mailer:PHP/" . phpversion()); // $msg = "<p style='color: darkgreen; font-weight: bold; font-size: 14px; margin: 12px 0px 0px 0px;'>Thank you! Your message has been sent.</p>"; // $brisket = "<img src='../images/Brisket180x180web.jpg' width='180px' height='180px' alt='Brisket Says Hi' />"; // } else { // $msg = "<p style='color: red; font-weight: bold; font-size: 14px; margin: 12px 0px 0px 0px;'>Please enter a valid email address!</p>"; // } } } ?> <body onload="loadMe('contact')"> <div id="container"> <div id="header"> <a href="../home/index.php" style="border:none"><div id="logo"></div></a> <div id="navBG"><?php include("../common/mainNav.php"); ?></div> </div><!--End Header--> <div id="contentArea"> <br /><img class="sideBox" src="../images/sideBox.jpg" width="12px" height="12px"><p class="sideItemSelected">contact us</p><br style="clear:both" /> <p class="sideItem"><a class="sideLink" href="./shipping.php">useful q & a</a></p> <div id="mainContent"> <h1>contact us</h1><br /> <h2>Have questions? Ready to order?<br /> <span style="color:#b5a072">Call 704.333.1595 Mon-Fri 9am - 5pm EST</span></h2> <p id="contactText" class="text">It's not business, it's personal! For instant answers to many questions about ordering, shipping, and other good stuff, please check the <a href="shipping.php">useful q&a</a> page. Nonetheless, we'll always be happy to answer your questions by phone or through the form below. We look forward to hearing from you.</p><br /> <div id="contactFormContainer"> <form method="post" id="contactForm" action="<?php echo($_SERVER['PHP_SELF']); ?>" > <div id="formContainer"> <input type="hidden" name="submitted" value="true" /> <input type="hidden" name="formname" value="contact" /> <div class="formRow"> <div class="itemSet"> <p class="itemLabel">Name</p> <input tabindex="1" class="itemContent" type="text" name="guestName" value='<?php echo $_POST[Name]; ?>' /> </div> <div class="itemSet"> <p class="itemLabel">City & state</p> <input tabindex="2" class="itemContent" type="text" name="cityState" /> </div> <br class="clearMe" /> </div> <div class="formRow"> <div class="itemSet"> <p class="itemLabel">Email Address</p> <input tabindex="3" class="itemContent" type="text" name="emailAddress" /> </div> <div class="itemSet"> <p class="itemLabel">Phone & best local time to call</p> <input tabindex="4" class="itemContent" type="text" name="phone" /> </div> </div> <div class="formRow"> <div> <p class="itemLabel">Your question</p> <textarea tabindex="5" id="msgContent" type="text" name="msgContent">Please telephone us to submit an order</textarea> </div> </div> <div class="formRow"> <div style="position: relative;"> <div style="float: left; margin-right: 40px;"> <input tabindex="6" id="submitButton" type="submit" name="submit" value="Submit" /> </div> <div style="float: left; margin-top: -10px;"> <?php //echo($msg); ?> </div> <br style="clear: both;" /> <div style="clear: both; position: absolute; top: -350px; left: -217px; width: 180px;"> <?php echo($msg); echo($brisket); ?> </div> <br style="clear: both;" /> </div> </div> </div> <!-- End Form Container --> </form> </div> <!-- End Contact Form --> </div> </div><!-- End Content Area--> <div id="bottomBar"></div> <?php include("../common/footer.php"); ?> </div><!-- End Container --> </body> </html> CODE STOPS HERE===================================== The below is flagging errors #3 and #9. Error #3 is being thrown even though the emails match. Code: [Select] <?php session_start(); $_SESSION['submitted']="yes"; $error=$_GET['error']; $date_rma="5/10/2011"; $content=' <div class="content_text"> <div class="content_header">Request RMA Number</div> <p>Enter the information you used on PayPal, that you completed your order with. The information must match, or a RMA Number will not be issued.</p> <form action="./rma_process.php" method="post"> <p><label>Name:</label> <input type="text" name="name" size="30" value="'.(isset($_SESSION['name']) ? $_SESSION['name'] : '').'" />'; if($error[0]==1){ $content.=' <span class="red bold">This field is required.</span>'; } $content.='</p> <p><label>E-Mail Address:</label> <input type="email" name="email" size="35" value="'.(isset($_SESSION['email']) ? $_SESSION['email'] : '').'" />'; if($error[1]==1){ $content.=' <span class="red bold">This field is required.</span>'; } $content.='</p> <p><label>Confirm E-Mail Address:</label> <input type="email" name="confirm_email" size="35" value="'.(isset($_SESSION['confirm_email']) ? $_SESSION['confirm_email'] : '').'" />'; if($error[2]==1){ $content.=' <span class="red bold">This field is required.</span>'; } if($error[3]==1){ $content.=' <span class="red bold">E-Mail addresses do not match.</span>'; } $content.='</p> <p><label>Phone Number:</label> <input type="text" name="phone" size="15" value="'.(isset($_SESSION['phone']) ? $_SESSION['phone'] : '').'" /> Ext. <input type="text" name="ext" size="4" value="'.(isset($_SESSION['ext']) ? $_SESSION['ext'] : '').'" />'; if($error[4]==1){ $content.=' <span class="red bold">A properly formatted phone number is required.</span>'; } $content.='</p> <p><label>Date of Purchase (MM/DD/YYYY):</label><input type="text" name="month" size="2" maxlength="2" value="'.(isset($_SESSION['month']) ? $_SESSION['month'] : '').'" /> <input type="text" name="day" size="2" maxlength="2" value="'.(isset($_SESSION['day']) ? $_SESSION['day'] : '').'" /> <input type="text" name="year" size="5" maxlength="4" value="'.(isset($_SESSION['year']) ? $_SESSION['year'] : '').'" />'; if($error[5]==1 || $error[6]==1 || $error[7]==1){ $content.=' <span class="red bold">A properly formatted date is required.</span>'; } $content.='</p><p><label>List the Products you wish to return. Sperate with a comma. <br />Use either the whole product name, or the GHP# Product Code:</label>'; if($error[8]==1){ $content.=' <span class="red bold">This field is required.</span>'; } $content.='<textarea name="products_returning" rows="10" cols="60"> '.(isset($_SESSION['products_returning']) ? $_SESSION['products_returning'] : '').''; $content.=' </textarea> <input type="hidden" name="submitted" value="yes" /> </p> <p><input type="submit" value="Submit" name="Submit" /></p> </form> </div> '; ?> Code: [Select] <?php session_start(); $name = $_POST['name']; $_SESSION['name']=$name; if($name==""){ $error0=1; } else{ $error0=0; } $email = $_POST['email']; $_SESSION['email']=$email; if($email==""){ $error1=1; } else{ $error1=0; } $confirm_email = $_POST['confirm_email']; $_SESSION['confirm_email']=$confirm_email; if($confirm_email==""){ $error2=1; } else{ $error2=0; } if($email!=$confirm_email){ $error3=1; } else{ $error3=0; } $phone = $_POST['phone']; $_SESSION['phone']=$phone; if($phone==""){ $error4=1; } else{ $error4=0; } $ext = $_POST['ext']; $_SESSION['ext']=$ext; $phone = $phone.' Ext.'.$ext; $month = $_POST['month']; $_SESSION['month']=$month; if($month=="" || !is_numeric($month)){ $error5=1; } else{ $error5=0; } $day = $_POST['day']; $_SESSION['day']=$day; if($day=="" || !is_numeric($day)){ $error6=1; } else{ $error6=0; } $year = $_POST['year']; $_SESSION['year']=$year; if($year=="" || !is_numeric($year)){ $error7=1; } else{ $error7=0; } $date="".$month."/".$day."/".$year.""; $products_returning = $_POST['products_returning']; $_SESSION['products_returning']=$products_returning; if($products_returning==""){ $error8=1; } else{ $error8=0; } if($_SESSION['submitted']=="yes"){ $error9=0; } else{ $error9=1; } $error="".$error0."".$error1."".$error2."".$error3."".$error4."".$error5."".$error6."".$error7."".$error8."".$error9.""; if($error!=="0000000000"){ header("Location: ./index.php?returns=rma&error=".$error0."".$error1."".$error2."".$error3."".$error4."".$error5."".$error6."".$error7."".$error8."".$error9.""); } else{ header("Location: ./index.php?returns=submitted"); } ?> I wrote the search form below to enable users search other users of a site based on certain criteria like age, race etc. Then I wrote the php script beneath, to execute that search. I decided to make the script very simple, searching only for one criterion for now (ethnicity). So even though I have several fields in the search form, I wrote the script to process only one of those fields(ethnicity). So basically, the script searches all records for members on the site from two tables called images and members(the members table has an "ethnicity column"), who meet the user's ethnicity preference and returns certain columns for all members who meet that preference. Well when I click the submit button, all I get is "Form not submitted". I added that form not submitted clause at the end of the script just after I had tweaked the script in every way possible but got nothing but a blank page every time I submitted the form. So take a look people and tell me what could be going wrong here. Appreciate any help. Code: [Select] <form id="search_profiles_form" action= "profile_search.php"> Seeking A: <select name= "sex"> <option value= "man">Man</option> <option value= "woman">Woman</option> <option value= "both">Both</option> <select> <p> <tab> Age Range: <?php print '<select name= "min_age">'; for ($age = 18; $age <= 99; $age++) { print "\n<option value=\"$age\">$age</option>"; } print '</select>'; ?> </tab> <tab> and: <?php print '<select name= "max_age">'; for ($age = 18; $age <= 99; $age++) { print "\n<option value=\"$age\">$age</option>"; } print '</select>'; ?> </tab> </p> <p>Distance: <select name= "distance"> <option name="5">Within 5 Miles</option> <option name="10">Within 10 Miles</option> <option name="50">Within 50 Miles</option> <option name="100">Within 100 Miles</option> <option name="250">Within 250 Miles</option> <option name="any">Beyond 250 Miles</option> </select> </p> <p>Ethnicity: <select name= "ethnicity"> <option name="black">Black/African Descent</option> <option name="white">Caucasian?European Descent</option> <option name="latino">Hispanic Non White</option> <option name="asian">Asian Descent</option> <option name="native_american">Native American</option> <option name="pacific_islander">Pacific Islander</option> <option name="indian">Indian Descent</option> <option name="middle_east">Middle Eastern</option> <option name="other">Other</option> </select> </p> <p>Last Active: <select name= "last_active"> <option name="0">Online Now</option> <option name="1">1 Hr Ago</option> <option name="5">5 Hrs Ago</option> <option name="24">24 Hrs Ago</option> <option name="1wk">1 Week Ago</option> <option name="3wk">Over 3 Weeks Ago</option> </select> </p> <input type="hidden" name="submitted" value="TRUE"/> <p> <input type ="submit" value="Search!"/> </p> </form> And here goes the php script. Code: [Select] <?php //address error handling ini_set ('display_errors', 1); error_reporting (E_ALL & ~E_NOTICE); //authenticate user require('auth.php'); if (isset($_POST['submitted'])) { // Connect to the database. require_once ('config.php'); //Query the database. $sql = "SELECT * FROM members INNER JOIN images ON members.member_id = images_member_id WHERE members.ethnicity = '{$_POST['ethnicity']}' AND images.cartegory = 'main' "; $query = mysql_query($sql); //Check for success here. if(!$query) { trigger_error("SQL query $sql failed: " . mysql_error(), E_ERROR); // Handle as desired }else{ //If query is valid. if(mysql_num_rows($query) > 0){ while ($row = mysql_fetch_assoc($query)){ //Redirect to search results page. echo $_POST['ethnicity']; echo $row['member_id']; echo $_SESSION['id']; echo $row['image']; } }else {//No rows returned. echo 'No results match this search query.' ; } }//End of else if query is valid. }else{ echo "form not submitted";} ?> Hey All! Well, here I am at PHP Freaks mercy again lol. I love this website and everyone here is always so helpful so let's get to my most recent issue. I am developing a pretty simple event registration form, which would be pretty easy in most respects. It will have the following pretty standard fields. Number of people attending: (drop down with 1-10) Name Address City State Zip Email Phone Alternate Phone There will be a few other fields but they aren't relevant. Basically the first field "Number of people attending (drop down 1-10)" will have to create a section with the following fields above for each person's information. If there are 3 people attending then it will need to have 3 sections of all those fields for each person. Making the page dynamically generate those sections on-the-fly when the user selects "3" for example is the first issue I am having. The other issue I am having is how would I handle the information dynamically within the PHP. If there was just one person it would be easy because I could just reference those fields. One solution I have for the second problem that I have some experience with is naming the fields name[] for example. But I still don't have a complete grasp on how to make that fix my problem. I've tried googling for hours but have had no luck, which may be because I'm not sure how to phrase the problem maybe. Any help! Hi, how would i display the date that is already in db and was submitted by user when he logs in to their profile? That code below works for the values like 'approved' 'denied' so on, but how would i do same for a date? thank you. Code: [Select] <?php include('config.php'); $uname=$_SESSION['username']; if($_SESSION['username']){ $sql="SELECT ApplicationStatus FROM table1 WHERE uname='$uname'"; $result=mysql_query($sql); $row = mysql_fetch_array($result);} echo '<form name="test" method="post"> <select name="ApplicationStatus"> <option value="">------</option> <option value="In process" '.(($row['column1']=='In process')?'selected="selected"':'').'>In process</option> <option value="Withdrawn" '.(($row['column1']=='Withdrawn')?'selected="selected"':'').'>Withdrawn</option> </select>'; ?> I'm wanting to add a custom form submit to my website, one identical to this Code: [Select] http://www.mobafire.com/league-of-legends/edit-buildhow hard would that be and how much do you think it would cost me? hi i was wondering how i can display the values for a form that already in db. users submitted a form and then when they log in to their profile they can change the value in a form, but the original value would show the one that they first submitted. makes sense? at the moment its set as blank, how would i display the option value to the one in the db on their profile? thanks Code: [Select] <form name="test" method="post"> <select name="ApplicationStatus"> <option value="'">------</option> <option value="In process">In process</option> <option value="Withdrawn">Withdrawn</option> </select> Hi, I have a search form which pulls info from a MySQL table and there are a few enhancements I would like to make. 1) I would like the search terms in my results table hilited in red. I made a class in my stylesheet for this, but it isn't working so I am missing a step or two 2) I would like a display for the number of results returned. Example. "There were 3 results found in your search". 3) This isn't php related, but if anyone has any ideas why my JQuery slideup doesn't work with my results let me know. I have posted in the JavaScript section, but haven't gotten a response. My code. Code: [Select] <html> <head> <link href="default.css" rel="stylesheet" type="text/css" media="screen" /> <script src="js/jquery.js"></script> <script src="js/jquery-fonteffect-1.0.0.js"></script> <script type="text/javascript"> $("#mirror").FontEffect({ outline:true }) </script> <script type='text/javascript'> var $ = jQuery.noConflict(); $(document).ready(function(){ $("#search_results").slideUp(); $("#search_button").click(function(e){ e.preventDefault(); ajax_search(); }); // $("#search_term").keyup(function(e){ // e.preventDefault(); // ajax_search(); // }); }); function ajax_search(){ $("#search_results").show(); var search_val=$("#search_term").val(); $.post("./find.php", {search_term : search_val}, function(data){ if (data.length>0){ $("#search_results").html(data); $(document).ready(function(){ $(".stripeMe tr").mouseover(function(){$(this).addClass("over");}).mouseout(function(){$(this).removeClass("over");}); $(".stripeMe tr:even").addClass("alt"); }); } }) } </script> <meta http-equiv="Content-Type" content="text/html; charset=iso- 8859-1" /> <title>Novo RPC Results Search Engine</title> <link href="default.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body> <div id="mirror">Search RPC participants</div> <form id="searchform" method="post" action="find.php"> <div> <label for="search_term">Search RPC information</label> <input type="text" name="search_term" id="search_term" /> <input type="submit" value="search" id="search_button" /> </div> </form> <div id="search_results"></div> </body> </html> <?php define(HOST, "localhost"); define(USER, "username"); define(PW, "pw"); define(DB, "DBName"); $connect = mysql_connect(HOST,USER,PW) or die('Could not connect to mysql server.' ); mysql_select_db(DB, $connect) or die('Could not select database.'); $term = strip_tags(substr($_POST['search_term'],0, 100)); $term = mysql_escape_string($term); $sql = "SELECT * FROM Phase1A_1B_TotalScores_2011 WHERE CONCAT(last_name,first_name,employee_id,title,territory,district,Phase1A_Score,Phase1B_HS_Exam, Phase1A_HS_Exam_RT,Phase1B_HS_Exam ,Phase1B_HS_Exam_RT,Class_Date) LIKE '%$term%' order by last_name asc"; $string = ''; $string = "<table class='stripeMe' id='Results'><tr><th>Last Name</th><th>First Name</th><th>Employee ID</th><th>Title</th><th>Territory</th><th>District</th><th>Phase 1A Score</th><th>Phase 1B Score</th><th>Phase 1 Average</th><th>Phase 1A HS Exam</th><th>Phase 1A HS Exam Retake</th><th>Phase 1B HS Exam</th><th>Phase 1B HS Exam Retake</th><th>Class Dates</th><th>Awards</th></tr>"; $result = mysql_query($sql); /// This is the execution if (mysql_num_rows($result) > 0){ while($row = mysql_fetch_object($result)){ $string .= "<tr>"; $string .= "<td>".$row->last_name."</td> "; $string .= "<td>".$row->first_name."</td>"; $string .= "<td>".$row->employee_id."</td>"; $string .= "<td>".$row->title."</b>"; $string .= "<td>".$row->territory."</td>"; $string .= "<td>".$row->district."</td>"; $string .= "<td>".$row->Phase1A_Score."</td>"; $string .= "<td>".$row->Phase1B_Score."</td>"; $string .= "<td>".$row->Phase1_Average."</td>"; $string .= "<td>".$row->Phase1A_HS_Exam."</td>"; $string .= "<td>".$row->Phase1A_HS_Exam_RT."</td>"; $string .= "<td>".$row->Phase1B_HS_Exam."</td>"; $string .= "<td>".$row->Phase1B_HS_Exam_RT."</td>"; $string .= "<td>".$row->Class_Date."</td>"; $string .= "<td>".$row->Awards."</td>"; $string .= "<br/>\n"; $string .= "</tr>"; //print_r($row); } $string .= "</table>"; }else{ $string = "<span class='NMF'>No matches found!</span>"; // echo $sql; } echo $string; ?> and lastly my CSS Code: [Select] /*search term styling*/ #search_term{ font-weight:bold; color:#f00; } i don't know what this would fall under, but it sounds like php..........is there a way to make a form make a new page from a template........like I have a picture page and I can upload pictures from a form with a picture name....and that name turns into a /name.php file? does this make sense? Hey everyone I'm pretty new at PHP so i'm hoping someone can help me with this code. What I am trying to do is if someone selects a state say Kansas then fills out the rest of the form and clicks submit it will go to a specific email address. If someone selects another state like Nebraska it will go to a separate email address. Here is my code and I hope someone can help me with this. PS I think I really screwed this one up lol :help: Thanks, B Code: [Select] <?php /* Subject and Email variables */ $emailSubject = 'Your Car Report Info.'; $webMaster = 'me@rustyeckford.com'; $webMaster2 ='me1@rustyeckford.com'; $webMaster3 ='me2@rustyeckford.com'; /* Gathering Data Variables */ $f_nameField = $_POST['f_name']; $l_nameField = $_POST['l_name']; $addField = $_POST['Address']; $stateField = $_POST['state']; $phoneField = $_POST['phone']; $emailField = $_POST['email']; $vinField = $_POST['vin']; $body = <<<EOD <br><hr><br> First Name: $f_name <br> Last Name: $l_name <br> Address: $Address <br> State: $state <br> Phone: $phone <br> Email: $email <br> VIN: $vin <br> EOD; switch($state) { case 'Kansas': case 'Oklahoma': $wm = $webMaster2; break; case 'Missouri': case 'Iowa': $wm = $webMaster3; break' case 'Nebraska: $wm = $webMaster; break; } $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($wm, $emailSubject, $body, $headers); /* Results rendered from Html */ $theResults = <<<EOD <html> <head> <title>Your Car Report - Results</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> body { background-color: #f1f1f1; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; line-height: normal; font-weight: normal; color: #666666; text-decoration: none; } </style> </head> <div> <div align="center">Thank you for your submission. Your vehicle report will be provided to you very soon!</div> </div> </body> </html> EOD; echo "$theResults"; ?> how do I make document upload fields like the ones that are on this website where there is a link at the bottom to make another field appear, or make it so that a new field automatically appears when the first one has info in it. Does this make sense? and also how would i make these submit with the form seeing as that they would have different field names, wouldn't they? Hi, I am having a problem with my form. It posts fine on Firefox 3.6 on my MAC, but not on Safari 5 on my MAC. It also does not work Internet Explorer 9, Firefox 4 or Google Chrome on a windows box. Basically it posts back to itself, no email is sent and it does not hit my sql database. Here is the pertinent code to my index.html file... Code: [Select] <script type="text/javascript"> function showMonth(str) { if (str=="") { document.getElementById("txtHint").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","reserv.php?q="+str,true); xmlhttp.send(); } </script> <form method="post" action="resersend.php"> <p><font face="arial" size="2" color="#336600">Reservation month:</font> <select name="months" onchange="showMonth(this.value)"> <option value="" selected="selected">Choose One</option> <option value="May 2011">May 2011</option> <option value="June 2011">June 2011</option> <option value="July 2011">July 2011</option> <option value="August 2011">August 2011</option> <option value="September 2011">September 2011</option> <option value="October 2011">October 2011</option> <option value="November 2011">November 2011</option> <option value="December 2011">December 2011</option> <option value="January 2012">January 2012</option> <option value="February 2012">February 2012</option> <option value="March 2012">March 2012</option> <option value="April 2012">April 2012</option> </select> </form></p> Here is the reserv.php file (code) that works with the html file.... Code: [Select] <?php $q=$_GET["q"]; $con = mysql_connect('my_host', 'my_user', 'my_pwd'); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("my_db", $con); $sql="SELECT * FROM daterange WHERE DEND > DATE(NOW()) AND STATUS='A' AND MONTH = '".$q."' ORDER BY RID, DATE, SITE"; $result = mysql_query($sql); // Determine the number of reservation dates $number = mysql_numrows($result); // Create drop-down menu of reservation dates print "<font size=\"3\" face=\"Arial\"><b>Select Your Reservation:</b><br> <form action=\"resersend.php\" method=\"post\"> <select name=\"RID\"> <option value=\"\">Choose One</option>"; for ($i=0; $i<$number; $i++) { $RID = mysql_result($result,$i,"RID"); $DATE = mysql_result($result,$i,"DATE"); $SITE = mysql_result($result,$i, "SITE"); $PRICE = mysql_result($result,$i, "PRICE"); print "<option value=\"$RID\">$DATE, $SITE, $PRICE</option>"; } print "</select><p align=left><label><font size=\"3\" face=\"Arial\">First Name: <input type=\"text\" name=\"FNAME\" size=\"50\" maxlength=\"50\" tabindex=\"1\"<br>"; print "<p align=left><label>Last Name: <input type=\"text\" name=\"LNAME\" size=\"50\" maxlength=\"50\" tabindex=\"2\"<br>"; print "<p align=left><label>Address Line 1: <input type=\"text\" name=\"ADDR1\" size=\"50\" maxlength=\"50\" tabindex=\"3\"<br>"; print "<p align=left><label>Address Line 2: <input type=\"text\" name=\"ADDR2\" size=\"50\" maxlength=\"50\" tabindex=\"4\"<br>"; print "<p align=left><label>City: <input type=\"text\" name=\"CITY\" size=\"50\" maxlength=\"50\" tabindex=\"5\"<br>"; print "<p align=left><label>State (abbrev.): <input type=\"text\" name=\"STATE\" size=\"2\" maxlength=\"2\" tabindex=\"6\"<br>"; print "<p align=left><label>Zip Code: <input type=\"text\" name=\"ZIP\" size=\"5\" maxlength=\"5\" tabindex=\"7\"<br>"; print "<p align=left><label>Contact Phone Number: (<input type=\"text\" name=\"PHONE1\" size=\"3\" maxlength=\"3\" tabindex=\"8\""; print "<label>)<input type=\"text\" name=\"PHONE2\" size=\"3\" maxlength=\"3\" tabindex=\"9\""; print "<label>-<input type=\"text\" name=\"PHONE3\" size=\"4\" maxlength=\"4\" tabindex=\"10\"<br>"; print "<p align=left><label>Email: <input type=\"text\" name=\"EMAIL\" size=\"50\" maxlength=\"50\" tabindex=\"11\"<br>"; print "<p align=left><input type=\"submit\" value=\"Book Now!\" name=\"submit\">"; print "<input type=\"reset\" value=\"reset\" name=\"reset\"></form>"; // Close the database connection mysql_close($con); ?> Anyone have any ideas? I suspect it may have to do with the javascript in the index.html file, but I can't nail it down. Thanks. ok, so how can I grab $value before the form submits and I want to put it into the image field: Code: [Select] <?php include_once "secure/connect_to_mysql.php"; function genRandomString($length = 20) { $characters = '0123456789'; $string =''; for ($p = 0; $p < $length; $p++) { $string .= $characters[mt_rand(0, strlen($characters))]; } return $string; } if ($_POST['submit']) { $name = $_POST['name']; $id = $_POST['id']; $image = $_POST['image']; $event = $_POST['event']; $template = 'Templates/index.php'; $picture = '$name.png'; $id = genRandomString(); //this could be the uploaded picture //we need just the filename - no extension $picture_name = pathinfo($picture, PATHINFO_FILENAME); $sql = "INSERT INTO pictures (name, id, image, event) VALUES('$name', '$id','$image','$event')"; $rs = mysql_query($sql) or die ("Problem with the query: $sql<br>" . mysql_error()); echo mysql_error(); $target_path = "images/"; foreach ($_FILES["uploadedfile"]["name"] as $key => $value) { $uploadfile = $target_path . basename($_FILES[uploadedfile][name][$key]); //echo $uploadfile; if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'][$key], $uploadfile)) { echo $value . ' uploaded<br>'; } } copy($template, "$name.php"); } ?> <form action="new.php" method="post" enctype="multipart/form-data"><input name="name" type="text" /><input name="id" type="hidden" value=<?php echo $id; ?> /><br /> <input name="event" type="text" /><input name="image" type="text" value="images/<?php echo $value; ?>" /><input type="hidden" name="MAX_FILE_SIZE" value="900000000000000000000000000000000000000000000000000000000000000000000000000" /> Choose a file to upload: <div id="dynamicInput"> Entry 1<br><input type="file" name="uploadedfile[]"> </div> <input type="button" value="Add another text input" onClick="addInput('dynamicInput');"> <br /><input name="submit" type="submit" value="submit" /></form> if I do it after the form submits then it shows up, is there a way to make it appear before it submits....like a second field echoing what the first field has typed it and it updates "live"? hi, i want to check in a form if a date submitted is not null, how can i modify this script if( empty($_POST['year'] . '-' . $_POST['month'] . '-' .$_POST['day']) Hi there, im trying to get value from form to PHP but its not working. <?php if (isset($_POST['cartype'])==0) { echo("Please select car type."); } else if (isset($_POST['carcolour'])==0) { echo("Please select car colour."); } else if (isset($_POST['carenginesize'])==0) { echo("Please select car engine size."); } else if (isset($_POST['terms'])==0) { echo("Please agree to site terms and conditions before submitting your order.<br/> Press the back button in your browser to try again."); } else{ $name=$_POST['firstname']; $lastname=$_POST['lastname']; $email=$_POST['emailaddress']; $phone=$_POST['phone']; $ctype=$_POST['cartype']; $colour=$_POST['carcolour']; $enginesize=$_POST['carenginesize']; $options=$_POST['options']; echo "Dear,"."$name"."$lastname"; echo "<br/>Thank you for your order"; echo "<br/>You're contact details a -"; echo "Phone : "."$phone"; echo "email: "."$email"; echo "<br/>You have selected the following car:"; echo "<br/>Car type:"."$ctype"; echo "<br/>Colour:"."$colour"; echo "<br/>Engine size:"."$enginesize"; echo "<br/>Options:<br/>"; $count=count($options); for($i=0;$i<$count;$i++) { echo $options[$i]."<br/>"; } $optn=array("6 disc DVD changer", "TV function", "DAB digital radio", "Loudspeaker system - professional ", "Multimedia navigation system", "Universal remote control", "Voice control", "Navigation system", "Head-up display", "Adaptive headlights", "Night vision with pedestrian recognition", "Run-flat tyres"); foreach($options as $optn) { echo "NEw option ".$optn."<br/>"; } } ?> Hi, I have a form that I want to allow users to be able to add specific links, some are set types (domains) and just require the iser to enter the link, however, one is for whatever they wish and they must enter a name to describe it. Now im going to enter it into a database with the following columns: USER_ID || LINK_URL || LINK_TYPE || LINK_NAME Link name is optional (only needed if the link type is their own custom one), the link types are ID's related to a table of link types (facebook, twitter etc). Now I'm assuming that to differentiate the form elements for insertion into the database I would need to have a hidden form element with the type ID inside? However I don't really know how to go on from here. A small version of the form would be <input type="text" name="facebook_link" /> <input type="hidden" name="facebook_id value="1" /> <input type="text" name="twitter_link" /> <input type="hidden" name="twitter_id value="2" /> <input type="text" name="own_site" /> <input type="text" name="own_site_description" /> <input type="hidden name="own_site_id" value="3" /> However, I'm assuming this is wrong because I'll need to enter everything into an array won't I? I just can't get my head round it to out put thi results into a foreach statement. Can anybody help me please? This topic has been moved to PHP Applications. http://www.phpfreaks.com/forums/index.php?topic=334084.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=334042.0 how can i validate if email is being entered correctly in a form? i have the following code Code: [Select] <?php if(isset($_POST['Submit'])){ //NEED TO CHECK IF FIELDS ARE FILLED IN if( empty($_POST['email'])){ header("Location:Messages.php?msg=12"); exit(); } if( empty($_POST['name'])){ header("Location:Messages.php?msg=3"); exit(); } if( empty($_POST['pw1']) && (empty($_POST['pw2']))){ header( "Location:Messages.php?msg=4" ); exit(); } $name=$_POST['name']; $email=$_POST['email']; $pw1=$_POST['pw1']; $pw2=$_POST['pw2']; if("$pw1" !== "$pw2" ){ header( "Location:Messages.php?msg=5" ); exit(); } $ip = $_SERVER['REMOTE_ADDR']; //connect to the db server , check if uname exist include('config.php'); $query1=("Select * from user where email='$email'"); $result1= mysql_query($query1); $num1=mysql_num_rows($result1); if ($num1 > 0) {//Email already been used header( "Location:Messages.php?msg=11" ); exit(); }else{ $query=("Select * from user where uname='$name'"); $result= mysql_query($query); $num=mysql_num_rows($result); if ($num > 0) {//Username already exist header( "Location:Messages.php?msg=6" ); exit(); }else{ //if username does not exist insert user details $query=( "INSERT INTO user (uname, pw,email,date_joined,ip,level) VALUES ('$name','$pw1','$email',NOW(),'$ip','Normal')"); if (@mysql_query ($query)) { header("location:login.php?reg=1"); exit; } } } mysql_close(); } ?> Hi all, not sure if this belongs in the Javascript section or PHP... I have a 3 pages, Index.php, a Javascript file and my display.php page. My Index page has a list of inputs which populate the variables in my javascript file when exectued, the javascript file then uses these variables to perform simple mathematical calculations and then displays the data using the innerHTML function back on my index page. From the index page I need to then post all my values, including these in the innerHTML div's as a POST array to my display.php only im unsure where to start. Hopefully thaat makes sense, would anybody have any idea on how to do this? Thanks Hi, im trying to have a math captcha in my registration form, but having trouble with setting it up in my form. sorry for the large code. If i change the value of $_POST['Submit'] to something else like $_POST['Submit1'] and then same for the math image captcha then it works, but i would like it to work as part of the form, makes sense? lol right now the form just posts the value and doesnt check for captcha values! if someone could help me out here that would be great! thank you. Code: [Select] <?php if(isset($_POST['Submit'])){ if($_POST['Submit'] != $_SESSION['security_number']) { $error = ""; } else { $error = ""; } //NEED TO CHECK IF FIELDS ARE FILLED IN if( empty($_POST['name']) && (empty($_POST['email']))){ header("Location:Messages.php?msg=3"); exit(); } if( empty($_POST['pw1']) && (empty($_POST['pw2']))){ header( "Location:Messages.php?msg=4" ); exit(); } $name=$_POST['name']; $email=$_POST['email']; $pw1=$_POST['pw1']; $pw2=$_POST['pw2']; if("$pw1" !== "$pw2" ){ header( "Location:Messages.php?msg=5" ); exit(); } $ip = $_SERVER['REMOTE_ADDR']; //connect to the db server , check if uname exist include('config.php'); $query1=("Select * from user where email='$email'"); $result1= mysql_query($query1); $num1=mysql_num_rows($result1); if ($num1 > 0) {//Email already been used header( "Location:Messages.php?msg=11" ); exit(); }else{ $query=("Select * from user where uname='$name'"); $result= mysql_query($query); $num=mysql_num_rows($result); if ($num > 0) {//Username already exist header( "Location:Messages.php?msg=6" ); exit(); }else{ //if username does not exist insert user details $query=( "INSERT INTO user (uname, pw,email,date_joined,ip,level) VALUES ('$name',md5('$pw1'),'$email',NOW(),'$ip','Normal')"); if (@mysql_query ($query)) { header("location:login.php?reg=1"); exit; } } } mysql_close(); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><!-- InstanceBegin template="/Templates/Auth.dwt.php" codeOutsideHTMLIsLocked="false" --> <head> <!-- InstanceBeginEditable name="doctitle" --> <title>Registration</title> <!-- InstanceEndEditable --> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <!-- InstanceBeginEditable name="head" --> <!-- InstanceEndEditable --> <link href="styleLog.css" rel="stylesheet" type="text/css"> <script language="javascript" type="text/javascript"> function reloadCaptcha() { document.getElementById('captcha').src = document.getElementById('captcha').src+ '?' +new Date(); } </script> </head> <body> <table width="100%" border="0" cellspacing="7" cellpadding="0"> <tr class="temptitle"> <td><!-- InstanceBeginEditable name="EditRegion4" -->New User Registration <!-- InstanceEndEditable --></td> </tr> <tr> <td><!-- InstanceBeginEditable name="EditRegion3" --> <form name="form1" action="register.php" method="post"> <table width="657" border="0"> <tr> <td width="122"><div align="left">Name</div></td> <td width="525"><input name="name" type="text" size="40"></td> </tr> <tr> <td><div align="left">Email</div></td> <td><input name="email" type="text" size="40"></td> </tr> <tr> <td><div align="left">Password</div></td> <td><input name="pw1" type="password" size="40"></td> </tr> <tr> <td ><div align="left">Confirm Password </div></td> <td><input name="pw2" type="password" size="40"></td> </tr> <tr> <td><img src="math_captcha/image.php" alt="Click to reload image" title="Click to reload image" id="captcha" onclick="javascript:reloadCaptcha()" /></td> <td><input type="text" name="Submit" value="what's the result?" onclick="this.value=''" /></td> <td> </tr> <tr> <td></td> <td> <input name="Submit" type="submit" value="Register"></td> </tr> </table> </form> <?=$error?> MOD EDIT: code tags added. I have taken a realy simple email form from w3c site and it's just not working for me at all Well the topic may not sound very explicit. So I'll do my best to explain it here. I have a pull down menu as part of a form, which contains the months of the year. I'm trying to store the value of this form entry using the $_POST['month'] variable into a database but first, I need to convert the month values into their corresponding integer values( that is 1 for January, 2 for February etc), in order to easily do date calculations later down the road. Any ideas about how to do this? It may be helpful to include the code for the pull down menu. Code: [Select] <p><tab> Date of Birth: <?php //Make the month pull down menu. //Array to store months. $months = array (1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); print '<select name= "month">'; foreach ($months as $key => $value) { print "\n<option value=\"$key\">$value</option>"; } print '</select>'; ?> </tab> <tab> <?php //Make the day pull down menu print '<select name= "day">'; for ($day = 1; $day <= 31; $day++) { print "\n<option value=\"$day\">$day</option>"; } print '</select>'; ?> </tab> <tab><?php //Make the year pull down menu print '<select name= "year">'; $start_year = date('Y'); for ($y = ($start_year - 18); $y >= 1900; $y--) { print "\n<option value=\"$y\">$y</option>"; } print '</select>'; ?> </tab> </p> When I submit my form the variables are sent to the url in my address bar and not to the php post page (resersend.php). Here is the pertinent html page code (index.html)... Code: [Select] <!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> <script type="text/javascript"> function showMonth(str) { if (str=="") { document.getElementById("txtHint").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","reserv.php?q="+str,true); xmlhttp.send(); } </script> </head> <body> <form> <p><font face="arial" size="2" color="#336600">Reservation month:</font> <select name="months" onchange="showMonth(this.value)"> <option value="" selected="selected">Choose One</option> <option value="May 2011">May 2011</option> <option value="June 2011">June 2011</option> <option value="July 2011">July 2011</option> <option value="August 2011">August 2011</option> <option value="September 2011">September 2011</option> <option value="October 2011">October 2011</option> <option value="November 2011">November 2011</option> <option value="December 2011">December 2011</option> <option value="January 2012">January 2012</option> <option value="February 2012">February 2012</option> <option value="March 2012">March 2012</option> <option value="April 2012">April 2012</option> </select> </form></p> </body> </html> And here is the php code from the page (reserv.php) that works with the above html page... Code: [Select] <?php $q=$_GET["q"]; $con = mysql_connect('My_host', 'my_user', 'my_password'); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("my_db", $con); $sql="SELECT * FROM daterange WHERE DEND > DATE(NOW()) AND STATUS='A' AND MONTH = '".$q."' ORDER BY RID, DATE, SITE"; $result = mysql_query($sql); // Determine the number of reservation dates $number = mysql_numrows($result); // Create drop-down menu of reservation dates print "<font size=\"3\" face=\"Arial\"><b>Select Your Reservation:</b><br> <form action=\"resersend.php\" method=\"post\"> <select name=\"RID\"> <option value=\"\">Choose One</option>"; for ($i=0; $i<$number; $i++) { $RID = mysql_result($result,$i,"RID"); $DATE = mysql_result($result,$i,"DATE"); $SITE = mysql_result($result,$i, "SITE"); $PRICE = mysql_result($result,$i, "PRICE"); print "<option value=\"$RID\">$DATE, $SITE, $PRICE</option>"; } print "</select><p align=left><label><font size=\"3\" face=\"Arial\">First Name: <input type=\"text\" name=\"FNAME\" size=\"50\" maxlength=\"50\" tabindex=\"1\"<br>"; print "<p align=left><label>Last Name: <input type=\"text\" name=\"LNAME\" size=\"50\" maxlength=\"50\" tabindex=\"2\"<br>"; print "<p align=left><label>Address Line 1: <input type=\"text\" name=\"ADDR1\" size=\"50\" maxlength=\"50\" tabindex=\"3\"<br>"; print "<p align=left><label>Address Line 2: <input type=\"text\" name=\"ADDR2\" size=\"50\" maxlength=\"50\" tabindex=\"4\"<br>"; print "<p align=left><label>City: <input type=\"text\" name=\"CITY\" size=\"50\" maxlength=\"50\" tabindex=\"5\"<br>"; print "<p align=left><label>State (abbrev.): <input type=\"text\" name=\"STATE\" size=\"2\" maxlength=\"2\" tabindex=\"6\"<br>"; print "<p align=left><label>Zip Code: <input type=\"text\" name=\"ZIP\" size=\"5\" maxlength=\"5\" tabindex=\"7\"<br>"; print "<p align=left><label>Contact Phone Number: (<input type=\"text\" name=\"PHONE1\" size=\"3\" maxlength=\"3\" tabindex=\"8\""; print "<label>)<input type=\"text\" name=\"PHONE2\" size=\"3\" maxlength=\"3\" tabindex=\"9\""; print "<label>-<input type=\"text\" name=\"PHONE3\" size=\"4\" maxlength=\"4\" tabindex=\"10\"<br>"; print "<p align=left><label>Email: <input type=\"text\" name=\"EMAIL\" size=\"50\" maxlength=\"50\" tabindex=\"11\"<br>"; print "<p align=left><input type=\"submit\" value=\"Book Now!\" name=\"submit\">"; print "<input type=\"reset\" value=\"reset\" name=\"reset\"></form>"; // Close the database connection mysql_close($con); ?> I am sure this is easy, but any help would be greatly appreciated. Thanks. Hi there, I was wondering if it was possible to change a forms action field with PHP. Basically, if there are several checkboxes for the user to select and a specific checkbox was selected, how would I redirect users to an alternative webpage on submit? I've been playing around with several methods, and one of them was: Code: [Select] <?php if(isset($_POST['Example']) && $_POST['Example'] == 'FormValueGoesHere') { echo ('./page1.php'); } else { echo ('./page2.php'); } ?> But the form action would only display page1.php even with nothing selected. Maybe I'm just being stupid because it's getting late, but I'd appreciate any assistance. Thanks Think I made a post about this earlier but doesn't show so dont think it posted successfully but if it did, my bad haha. Basicly I have a form which sends info to my database table after submitted. I added some form validation so when the user didn't enter a required field, text appears stating that the field needs to be entered. However, whether the field is entered or not, if the user submits the info still goes to the database. How do I fix it so that it only sends the info to the database once the required fields are entered? Do I go about it with an if statement? Heres my code up until now: Code: [Select] <?php if (isset($_POST['submit'])) { // forms inputs set to variables $cname = mysql_real_escape_string($_POST['cname']); $sname = mysql_real_escape_string($_POST['sname']); $init = mysql_real_escape_string($_POST['init']); $fname = mysql_real_escape_string($_POST['fname']); $title = mysql_real_escape_string($_POST['title']); $msname = mysql_real_escape_string($_POST['msname']); $dob = mysql_real_escape_string($_POST['dob']); $sex = mysql_real_escape_string($_POST['sex']); $lang = mysql_real_escape_string($_POST['lang']); $idno = mysql_real_escape_string($_POST['idno']); $telh = mysql_real_escape_string($_POST['telh']); $telw = mysql_real_escape_string($_POST['telw']); $cell = mysql_real_escape_string($_POST['cel']); $fax = mysql_real_escape_string($_POST['fax']); $email = mysql_real_escape_string($_POST['email']); $address = mysql_real_escape_string($_POST['address']); $errorstring =""; //default value of error string if (!$sname) $errorstring = $errorstring . "Surname<br>"; if (!$fname) $errorstring = $errorstring . "First name<br>"; if (!$title) $errorstring = $errorstring . "title<br>"; if (!$dob) $errorstring = $errorstring . "date of birth<br>"; if (!$sex) $errorstring = $errorstring . "sex<br>"; if (!$idno) $errorstring = $errorstring . "id number<br>"; if (!$email) $errorstring = $errorstring . "email address<br>"; if (!$address) $errorstring = $errorstring . "address<br>"; if ($errorstring!="") echo "Please fill out the following fields:<br>$errorstring"; else { //run code die("success!"); } // query $sql = "INSERT INTO student (sno, cname, sname, init, fname, title, msname, dob, sex, lang, idno, telh, telw, cel, fax, email, address ) VALUES ('', '$cname', '$sname', '$init', '$fname', '$title', '$msname', '$dob', '$sex','$lang', '$idno', '$telh', '$telw', '$$cell', '$fax', '$email', '$address')"; mysql_query($sql) or die('Error:' . mysql_error()); } mysql_close($link); ?> It's a project, first time I'm attempting form validation so this is rather new for me. With that being said, please feel free to give any tips and criticism as this is a learning curve for me. Also I'm probably going to add some security later for sql injection etc. so if anyone has some tips on that it would be great. Almost done with that damn project, thanks in advance This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=333815.0 What I'm trying to do is have it select the answers that are associated to that poll so that I can make a poll form out of this. Code: [Select] function getpoll($dbc) { $query = " SELECT polls.ID, polls.question, polls.totalVotes, (SELECT pollAnswers.ID, pollAnswers.answer FROM pollAnswers WHERE pollAnswers.pollID = polls.ID) FROM polls INNER JOIN pollAnswers ON polls.ID = pollAnswers.pollID WHERE polls.statusID = '1' ORDER BY polls.ID DESC LIMIT 1"; $result = mysqli_query($dbc, $query); $numrows = mysqli_num_rows($result); if ($numrows > "0") { } else { print "<p class=none>There are currently no open polls."; } } Hi, Im sort of new to PHP. I currently have this code Code: [Select] if(!empty($myrow['email'])){ echo "<a href=\"mailto: ".$myrow['email']."\">".$myrow['email']; echo "</a><br>";}Which just displays a email from the database and when clicked opens Outlook or some other email program. What i'm trying to do is hide the email and in its place put a link like "Contact" or a simple form that would send a email from my website to that email address. Does any one know any links to tutorials or at least a name for a script that would allow me to do this? Cheers! Hi there, I found a Javascript with what I want, but I want it to be in PHP because if people don't have Javascript enabled, they won't see the login. Here is what I have, but I need it to be converted to PHP: Code: [Select] function loginArea() { val = document.loginForm.password.value; switch(val) { case "password1": document.location = 'http://www.google.com/password1-page/'; break; case "password2": document.location = 'http://www.google.com/password2-page/'; break; default: document.location ='http://www.google.com/sorry/'; break; } } Code: [Select] <form name="loginForm" id="loginForm" method="post" action=""> <input name="password" type="text" id="password" maxlength="5" /> <input name="login" type="button" id="login" value="Check" onclick="loginArea()" /> </form> Help? - Steph Creating my own little MVC framework to understand it better. Question - When a view outputs a page with a form in it, how is the form handled? ie, what is the action of the form? Where does the IF statement that checks if the submit button was pressed, go? I was told inside a method in the Model...but I don't understand how a method can check if a form has been submitted or not. Any help greatly appreciated. Hi, sorry for being a newbie, but I need help setting up a dynamic form. The form will be a reservation type form. I have a single table, which I will post below. What I am looking to do is choose a month from a select box and then have it populate another select box with the available dates. Here is my table info from mysql... Code: [Select] CREATE TABLE `daterange` ( `RID` int(5) NOT NULL auto_increment, `DEND` date NOT NULL, `MONTH` varchar(50) NOT NULL, `DATE` varchar(50) NOT NULL, `SITE` varchar(50) NOT NULL, `PRICE` varchar(10) NOT NULL, `STATUS` varchar(1) NOT NULL default 'A', `FNAME` varchar(50) NOT NULL, `LNAME` varchar(50) NOT NULL, `ADDR1` varchar(50) NOT NULL, `ADDR2` varchar(50) NOT NULL, `CITY` varchar(50) NOT NULL, `STATE` varchar(2) NOT NULL, `ZIP` varchar(5) NOT NULL, `PHONE1` varchar(3) NOT NULL, `PHONE2` varchar(3) NOT NULL, `PHONE3` varchar(4) NOT NULL, `EMAIL` varchar(50) NOT NULL, PRIMARY KEY (`RID`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=83 ; Here is a sample mysql dump... Code: [Select] INSERT INTO `daterange` VALUES(1, '2011-05-15', 'May 2011', '5/15-5/22/11', 'Carterville Pond/Adirondack', '$2625.00', 'N', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); INSERT INTO `daterange` VALUES(2, '2011-05-22', 'May 2011', '5/22-5/29/11', 'Carterville Pond/Adirondack', '$2625.00', 'A', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); INSERT INTO `daterange` VALUES(3, '2011-05-29', 'May 2011', '5/29-6/5/11', 'Carterville Pond/Adirondack', '$2625.00', 'A', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''); Finally, here is a php form that I started to develop but it only has a single select box, which works but I wanted another select box that will filter the list down a little... Code: [Select] <? // script to display all the Available Reservations in the daterange table // connection information $hostName = "my_host"; $userName = "my_user"; $password = "my_pass"; $dbName = "my_db"; // make connection to database mysql_connect($hostName, $userName, $password) or die("Unable to connect to host $hostName"); mysql_select_db($dbName) or die("Unable to select database $dbName"); // Select all the fields in all the records of the daterange table $query = "SELECT * FROM daterange WHERE DEND > DATE(NOW()) AND STATUS='A' ORDER BY RID, DATE, SITE"; $result = mysql_query($query); // Determine the number of reservation dates $number = mysql_numrows($result); // Create drop-down menu of reservation dates print "<font size=\"3\" face=\"Arial\"><b>Select Reservation Date:</b> <form action=\"test.php\" method=\"post\"> <select name=\"RID\"> <option value=\"\">Choose One</option>"; for ($i=0; $i<$number; $i++) { $RID = mysql_result($result,$i,"RID"); $DATE = mysql_result($result,$i,"DATE"); $SITE = mysql_result($result,$i, "SITE"); $PRICE = mysql_result($result,$i, "PRICE"); print "<option value=\"$RID\">$DATE, $SITE, $PRICE</option>"; } print "</select><p align=left><label><font size=\"3\" face=\"Arial\">First Name: <input type=\"text\" name=\"FNAME\" size=\"50\" maxlength=\"50\" tabindex=\"1\"<br>"; print "<p align=left><label>Last Name: <input type=\"text\" name=\"LNAME\" size=\"50\" maxlength=\"50\" tabindex=\"2\"<br>"; print "<p align=left><label>Address Line 1: <input type=\"text\" name=\"ADDR1\" size=\"50\" maxlength=\"50\" tabindex=\"3\"<br>"; print "<p align=left><label>Address Line 2: <input type=\"text\" name=\"ADDR2\" size=\"50\" maxlength=\"50\" tabindex=\"4\"<br>"; print "<p align=left><label>City: <input type=\"text\" name=\"CITY\" size=\"50\" maxlength=\"50\" tabindex=\"5\"<br>"; print "<p align=left><label>State (abbrev.): <input type=\"text\" name=\"STATE\" size=\"2\" maxlength=\"2\" tabindex=\"6\"<br>"; print "<p align=left><label>Zip Code: <input type=\"text\" name=\"ZIP\" size=\"5\" maxlength=\"5\" tabindex=\"7\"<br>"; print "<p align=left><label>Contact Phone Number: (<input type=\"text\" name=\"PHONE1\" size=\"3\" maxlength=\"3\" tabindex=\"8\""; print "<label>)<input type=\"text\" name=\"PHONE2\" size=\"3\" maxlength=\"3\" tabindex=\"9\""; print "<label>-<input type=\"text\" name=\"PHONE3\" size=\"4\" maxlength=\"4\" tabindex=\"10\"<br>"; print "<p align=left><label>Email: <input type=\"text\" name=\"EMAIL\" size=\"50\" maxlength=\"50\" tabindex=\"11\"<br>"; print "<p align=left><label>Payment Method: <select name=\"PM\"> <option value=\"\">Choose One</option> <option value=\"Visa\">Visa</option> <option value=\"Mastercard\">Mastercard</option> <option value=\"Discover\">Discover</option>"; print "</select><p align=left><label>Credit Card Number: <input type=\"text\" name=\"C1\" size=\"4\" maxlength=\"4\" tabindex=\"12\""; print "<label> <input type=\"text\" name=\"C2\" size=\"4\" maxlength=\"4\" tabindex=\"13\""; print "<label> <input type=\"text\" name=\"C3\" size=\"4\" maxlength=\"4\" tabindex=\"14\""; print "<label> <input type=\"text\" name=\"C4\" size=\"4\" maxlength=\"4\" tabindex=\"15\"<br>"; print "<p align=left><label>Expiration Month: <select name=\"EXM\"> <option value=\"\">Choose One</option> <option value=\"January\">January</option> <option value=\"February\">February</option> <option value=\"March\">March</option> <option value=\"April\">April</option> <option value=\"May\">May</option> <option value=\"June\">June</option> <option value=\"July\">July</option> <option value=\"August\">August</option> <option value=\"September\">September</option> <option value=\"October\">October</option> <option value=\"November\">November</option> <option value=\"December\">December</option>"; print "</select><p align=left><label> Expiration Year: <select name=\"EXY\"> <option value=\"\">Choose One</option> <option value=\"2011\">2011</option> <option value=\"2012\">2012</option> <option value=\"2013\">2013</option> <option value=\"2014\">2014</option> <option value=\"2015\">2015</option> <option value=\"2016\">2016</option> <option value=\"2017\">2017</option> <option value=\"2018\">2018</option> <option value=\"2019\">2019</option> <option value=\"2020\">2020</option>"; print "</select><p align=left><label>Security Code (3 or 4 digits): <input type=\"text\" name=\"CSC\" size=\"4\" maxlength=\"4\" tabindex=\"16\"<br>"; print "<p align=left><input type=\"submit\" value=\"Book Now!\" name=\"submit\"></form>"; print " <input type=\"reset\" value=\"reset\" name=\"reset\"></form>"; // Close the database connection mysql_close(); ?> Sorry this is so long, any help would be appreciated...... -Bob First of all excuse me if this topic is inappropriate in this forum. But I think it's rather a PHP problem. I can't figure out multiple duplicate database records on submitting a form. The database table have two columns: the first one 'Id' with AUTO_INCREMENT and the second one 'Name'. Here's the php code for database insertion and the form: ------------------------------------------------------------------ <?php if($_GET['add_name']){ $host = *******; $user = *******'; $pass = *******; $db = *******; $con = mysql_connect($host,$user,$pass) or die; mysql_select_db($db,$con); $name = $_GET['add_name']; $sql = "INSERT INTO names (Name) VALUES ('$name')"; mysql_query($sql); } ?> <form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="GET"> Your Name: <input name="add_name" type="text" /> <input type="submit" value="Submit" /> </form> ------------------------------------------------------------------ After submitting the form to itself once I have multiple Name entries with different Ids. The curious thing is that with Chrome browser I get two duplicate records, with Mozilla - three of them. Seems like mysql_query runs multiple times. It works fine when submitting the form to a separate script and not to itself. Do I miss something? It must be very basic. The top half of this code works great ( where the HR line across ) now I'm trying to get it to post the some of the same data to another process script. I keep getting errors. can some please tell me what I'm doing wrong or missing. <?php function dataPost($fieldValue){ //extract data from the post extract($_POST); //set POST variables $url = 'http://www.domain.com/processform1.phpp'; $fields = array( 'how_you_heard_about_us'=>$how_you_heard_about_us, 'how_you_heard_about_us_other'=>$how_you_heard_about_us_other, 'chk_atm_machines'=>$chk_atm_machines, 'custom1'=>$custom1, 'txt_business_adrss'=>$txt_business_adrss, 'txt_city'=>$txt_city, 'txt_state'=>$txt_state, 'txt_zip'=>$txt_zip, 'txt_country'=>$txt_country, 'txt_phone'=>$txt_phone, 'txt_fax'=>$txt_fax, 'txt_website'=>$txt_website, 'firstname'=>$firstname, ); //url-ify the data for the POST foreach($fields as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string,'&'); //open connection $ch = curl_init(); //set the url, number of POST vars, POST data curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_POST,count($fields)); curl_setopt($ch,CURLOPT_POSTFIELDS,$fields_string); //execute post $result = curl_exec($ch); //close connection curl_close($ch); from here down I'm not to sure with..... //create array of data to be posted $post_data['firstname'] = 'firstname'; $post_data['custom1'] = 'custom1'; $post_data['txt_state'] = 'txt_state'; //traverse array and prepare data for posting (key1=value1) foreach ( $post_data as $key => $value) { $post_items[] = $key . '=' . $value; } //create the final string to be posted using implode() $post_string = implode ('&', $post_items); //create cURL connection $curl_connection = curl_init('http://www.domain.com/processform2.php'); //set options curl_setopt($curl_connection, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($curl_connection, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"); curl_setopt($curl_connection, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl_connection, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl_connection, CURLOPT_FOLLOWLOCATION, 1); //set data to be posted curl_setopt($curl_connection, CURLOPT_POSTFIELDS, $post_string); //perform our request $result = curl_exec($curl_connection); //show information regarding the request print_r(curl_getinfo($curl_connection)); echo curl_errno($curl_connection) . '-' . curl_error($curl_connection); //close the connection curl_close($curl_connection); } dataPost('Some Data'); ?> Hi, I'm quite a newbie to PHP and am doing a website. Have got a login working and the registration half way there, but am now in process of putting validation in Registration form. Have got the errors appearing if domething isn't filled in or if the username is taken however, it clears all the fields and i would like it to keep the values in them if possible. Is there an easy way round this? I can give my code if needed Cozzy Hello to everyone! I'm complete new in PHP and have the next problem: Please correct the following error: Enter your name doesn't matter if the field(Your name:) is filled or not Code: [Select] <form method="post" action="send.php" id="recomendus"> <table style="width: 100%;" border="0" cellspacing="6px" cellpadding="0" align="center"> <tbody> <tr> <td width="1%"><span style="color: #ff0000;">*</span></td> <td width="39%">Email:</td> <td width="60%"><label> <input id="email" type="text" name="clentEmail" value="" /> </label></td> </tr> <tr> <td><span style="color: #ff0000;">*</span></td> <td>First Name:</td> <td><input id="clentFname" type="text" name="yourname" value="" /></td> </tr> <tr> <td><span style="color: #ff0000;">*</span></td> <td>Last Name:</td> <td><input id="clentLname" type="text" name="clentLname" value="" /></td> </tr> <tr> <td><span style="color: #ff0000;">*</span></td> <td>Country:</td> <td><select id="Country2" name="Country2"> <option value="Albania">Albania</option> <option value="Algeria">Algeria</option> <option value="American Samoa">American Samoa</option> <option value="Andorra">Andorra</option> <option value="Angola">Angola</option> <option value="Anguilla">Anguilla</option> <option value="Antarctica">Antarctica</option> <option value="Antigua and Barbuda">Antigua and Barbuda</option> <option value="Argentina">Argentina</option> <option value="Armenia ">Armenia </option> <option value="Aruba">Aruba</option> <option value="Australia">Australia</option> <option value="Austria">Austria</option> <option value="Azerbaijan">Azerbaijan</option> <option value="Bahamas">Bahamas</option> <option value="Bahrain">Bahrain</option> <option value="Bangladesh">Bangladesh</option> <option value="Barbados">Barbados</option> <option value="Belarus">Belarus</option> <option value="Belgium">Belgium</option> <option value="Belize">Belize</option> <option value="Benin">Benin</option> <option value="Bermuda ">Bermuda </option> <option value="Bhutan">Bhutan</option> <option value="Bolivia">Bolivia</option> <option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option> <option value="Botswana">Botswana</option> <option value="Bouvet Island">Bouvet Island</option> <option value="Brazil">Brazil</option> <option value="British Indian Ocean Territory">British Indian Ocean Territory</option> <option value="Brunei Darussalam ">Brunei Darussalam </option> <option value="Bulgaria">Bulgaria</option> <option value="Burkina Faso">Burkina Faso</option> <option value="Burundi">Burundi</option> <option value="Cambodia">Cambodia</option> <option value="Cameroon">Cameroon</option> <option value="Canada">Canada</option> <option value="Cape Verde">Cape Verde</option> <option value="Cayman Islands">Cayman Islands</option> <option value="Central African Republic ">Central African Republic </option> <option value="Chad">Chad</option> <option value="Chile">Chile</option> <option value="China">China</option> <option value="Christmas Island">Christmas Island</option> <option value="Cocos Islands">Cocos Islands</option> <option value="Colombia">Colombia</option> <option value="Comoros">Comoros</option> <option value="Congo">Congo</option> <option value="Congo, Democratic Republic of the">Congo, Democratic Republic of the</option> <option value="Cook Islands ">Cook Islands </option> <option value="Costa Rica">Costa Rica</option> <option value="Cote d">Cote d'Ivoire</option> <option value="Croatia">Croatia</option> <option value="Cuba">Cuba</option> <option value="Cyprus">Cyprus</option> <option value="Czech Republic">Czech Republic</option> <option value="Denmark">Denmark</option> <option value="Djibouti">Djibouti</option> <option value="Dominica">Dominica</option> <option value="Dominican Republic">Dominican Republic</option> <option value="Ecuador ">Ecuador </option> <option value="Egypt">Egypt</option> <option value="El Salvador">El Salvador</option> <option value="Equatorial Guinea">Equatorial Guinea</option> <option value="Eritrea">Eritrea</option> <option value="Estonia">Estonia</option> <option value="Ethiopia">Ethiopia</option> <option value="Falkland Islands">Falkland Islands</option> <option value="Faroe Islands">Faroe Islands</option> <option value="Fiji">Fiji</option> <option value="Finland">Finland</option> <option value="France ">France </option> <option value="French Guiana">French Guiana</option> <option value="French Polynesia">French Polynesia</option> <option value="Gabon">Gabon</option> <option value="Gambia">Gambia</option> <option value="Georgia">Georgia</option> <option value="Germany">Germany</option> <option value="Ghana">Ghana</option> <option value="Gibraltar">Gibraltar</option> <option value="Greece">Greece</option> <option value="Greenland">Greenland</option> <option value="Grenada">Grenada</option> <option value="Guadeloupe ">Guadeloupe </option> <option value="Guam">Guam</option> <option value="Guatemala">Guatemala</option> <option value="Guinea">Guinea</option> <option value="Guinea-Bissau">Guinea-Bissau</option> <option value="Guyana">Guyana</option> <option value="Haiti">Haiti</option> <option value="Heard Island and McDonald Islands">Heard Island and McDonald Islands</option> <option value="Honduras">Honduras</option> <option value="Hong Kong">Hong Kong</option> <option value="Hungary ">Hungary </option> <option value="Iceland">Iceland</option> <option value="India">India</option> <option value="Indonesia">Indonesia</option> <option value="Iran">Iran</option> <option value="Iraq">Iraq</option> <option value="Ireland">Ireland</option> <option value="Israel">Israel</option> <option value="Italy">Italy</option> <option value="Jamaica">Jamaica</option> <option value="Japan">Japan</option> <option value="Jordan">Jordan</option> <option value="Kazakhstan">Kazakhstan</option> <option value="Kenya">Kenya</option> <option value="Kiribati">Kiribati</option> <option value="Kuwait">Kuwait</option> <option value="Kyrgyzstan ">Kyrgyzstan </option> <option value="Laos">Laos</option> <option value="Latvia">Latvia</option> <option value="Lebanon">Lebanon</option> <option value="Lesotho">Lesotho</option> <option value="Liberia">Liberia</option> <option value="Libya">Libya</option> <option value="Liechtenstein">Liechtenstein</option> <option value="Lithuania">Lithuania</option> <option value="Luxembourg">Luxembourg</option> <option value="Macao">Macao</option> <option value="Madagascar">Madagascar</option> <option value="Malawi">Malawi</option> <option value="Malaysia">Malaysia</option> <option value="Maldives ">Maldives </option> <option value="Mali">Mali</option> <option value="Malta">Malta</option> <option value="Marshall Islands">Marshall Islands</option> <option value="Martinique">Martinique</option> <option value="Mauritania">Mauritania</option> <option value="Mauritius">Mauritius</option> <option value="Mayotte">Mayotte</option> <option value="Mexico">Mexico</option> <option value="Micronesia">Micronesia</option> <option value="Moldova">Moldova</option> <option value="Monaco">Monaco</option> <option value="Mongolia">Mongolia</option> <option value="Montenegro ">Montenegro </option> <option value="Montserrat">Montserrat</option> <option value="Morocco">Morocco</option> <option value="Mozambique">Mozambique</option> <option value="Myanmar">Myanmar</option> <option value="Namibia">Namibia</option> <option value="Nauru">Nauru</option> <option value="Nepal">Nepal</option> <option value="Netherlands">Netherlands</option> <option value="Netherlands Antilles">Netherlands Antilles</option> <option value="New Caledonia">New Caledonia</option> <option value="New Zealand">New Zealand</option> <option value=" Nicaragua"> Nicaragua</option> <option value="Niger">Niger</option> <option value="Nigeria">Nigeria</option> <option value="Norfolk Island">Norfolk Island</option> <option value="North Korea">North Korea</option> <option value="Norway">Norway</option> <option value="Oman">Oman</option> <option value="Pakistan">Pakistan</option> <option value="Palau">Palau</option> <option value="Palestinian Territory">Palestinian Territory</option> <option value="Panama">Panama</option> <option value=" Papua New Guinea"> Papua New Guinea</option> <option value="Paraguay">Paraguay</option> <option value="Peru">Peru</option> <option value="Philippines">Philippines</option> <option value="Pitcairn">Pitcairn</option> <option value="Poland">Poland</option> <option value="Portugal">Portugal</option> <option value="Puerto Rico">Puerto Rico</option> <option value="Qatar">Qatar</option> <option value="Romania">Romania</option> <option value="Russian Federation">Russian Federation</option> <option value="Rwanda ">Rwanda </option> <option value="Saint Helena">Saint Helena</option> <option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option> <option value="Saint Lucia">Saint Lucia</option> <option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option> <option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option> <option value="Samoa ">Samoa </option> <option value="San Marino">San Marino</option> <option value="Sao Tome and Principe">Sao Tome and Principe</option> <option value="Saudi Arabia">Saudi Arabia</option> <option value="Senegal">Senegal</option> <option value="Serbia">Serbia</option> <option value="Seychelles">Seychelles</option> <option value="Sierra Leone">Sierra Leone</option> <option value="Singapore">Singapore</option> <option value="Slovakia">Slovakia</option> <option value="Slovenia ">Slovenia </option> <option value="Solomon Islands">Solomon Islands</option> <option value="Somalia">Somalia</option> <option value="South Africa">South Africa</option> <option value="South Georgia">South Georgia</option> <option value="South Korea">South Korea</option> <option value="Spain">Spain</option> <option value="Sri Lanka">Sri Lanka</option> <option value="Sudan">Sudan</option> <option value="Suriname">Suriname</option> <option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option> <option value=" Swaziland"> Swaziland</option> <option value="Sweden">Sweden</option> <option value="Switzerland">Switzerland</option> <option value="Syrian Arab Republic">Syrian Arab Republic</option> <option value="Taiwan">Taiwan</option> <option value="Tajikistan">Tajikistan</option> <option value="Tanzania">Tanzania</option> <option value="Thailand">Thailand</option> <option value="The Former Yugoslav Republic of Macedonia ">The Former Yugoslav Republic of Macedonia </option> <option value="Timor-Leste">Timor-Leste</option> <option value="Togo">Togo</option> <option value="Tokelau">Tokelau</option> <option value="Tonga">Tonga</option> <option value="Trinidad and Tobago">Trinidad and Tobago</option> <option value="Tunisia">Tunisia</option> <option value="Turkey">Turkey</option> <option value="Turkmenistan">Turkmenistan</option> <option value="Tuvalu">Tuvalu</option> <option value="Uganda">Uganda</option> <option value="Ukraine">Ukraine</option> <option value="United Arab Emirates ">United Arab Emirates </option> <option selected="selected" value="United Kingdom">United Kingdom</option> <option value="United States">United States</option> <option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option> <option value="Uruguay">Uruguay</option> <option value="Uzbekistan">Uzbekistan</option> <option value="Vanuatu">Vanuatu</option> <option value="Vatican City">Vatican City</option> <option value="Venezuela">Venezuela</option> <option value=" Vietnam"> Vietnam</option> <option value="Virgin Islands, British">Virgin Islands, British</option> <option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option> <option value="Wallis and Futuna">Wallis and Futuna</option> <option value="Western Sahara">Western Sahara</option> <option value="Yemen">Yemen</option> <option value="Zambia">Zambia</option> <option value="Zimbabwe">Zimbabwe</option> </select></td> </tr> </tbody> </table> <p><strong>Friend Details</strong></p> <table style="width: 100%;" border="0" cellspacing="6px" cellpadding="0" align="center"> <tbody> <tr> <td width="1%"><span style="color: #ff0000;">*</span></td> <td width="39%">Email:</td> <td width="60%"><label> <input id="email2" type="text" name="email2" value="" /> </label></td> </tr> <tr> <td><span style="color: #ff0000;">*</span></td> <td>Title:</td> <td><label> <select id="Title" name="Title"> <option value="">[Select Title]</option> <option value="Mr.">Mr.</option> <option value="Mrs.">Mrs.</option> <option value="Miss.">Miss.</option> <option value="Ms.">Ms.</option> <option value="Dr.">Dr.</option> </select> </label></td> </tr> <tr> <td><span style="color: #ff0000;">*</span></td> <td>First Name:</td> <td><input id="FirstName" type="text" name="FirstName" value="" /></td> </tr> <tr> <td><span style="color: #ff0000;">*</span></td> <td>Last Name:</td> <td><input id="LastName" type="text" name="LastName" value="" /></td> </tr> <tr> <td><span style="color: #ff0000;">*</span></td> <td>Country:</td> <td><select id="Country" name="Country"> <option value="Albania">Albania</option> <option value="Algeria">Algeria</option> <option value="American Samoa">American Samoa</option> <option value="Andorra">Andorra</option> <option value="Angola">Angola</option> <option value="Anguilla">Anguilla</option> <option value="Antarctica">Antarctica</option> <option value="Antigua and Barbuda">Antigua and Barbuda</option> <option value="Argentina">Argentina</option> <option value="Armenia ">Armenia </option> <option value="Aruba">Aruba</option> <option value="Australia">Australia</option> <option value="Austria">Austria</option> <option value="Azerbaijan">Azerbaijan</option> <option value="Bahamas">Bahamas</option> <option value="Bahrain">Bahrain</option> <option value="Bangladesh">Bangladesh</option> <option value="Barbados">Barbados</option> <option value="Belarus">Belarus</option> <option value="Belgium">Belgium</option> <option value="Belize">Belize</option> <option value="Benin">Benin</option> <option value="Bermuda ">Bermuda </option> <option value="Bhutan">Bhutan</option> <option value="Bolivia">Bolivia</option> <option value="Bosnia and Herzegovina">Bosnia and Herzegovina</option> <option value="Botswana">Botswana</option> <option value="Bouvet Island">Bouvet Island</option> <option value="Brazil">Brazil</option> <option value="British Indian Ocean Territory">British Indian Ocean Territory</option> <option value="Brunei Darussalam ">Brunei Darussalam </option> <option value="Bulgaria">Bulgaria</option> <option value="Burkina Faso">Burkina Faso</option> <option value="Burundi">Burundi</option> <option value="Cambodia">Cambodia</option> <option value="Cameroon">Cameroon</option> <option value="Canada">Canada</option> <option value="Cape Verde">Cape Verde</option> <option value="Cayman Islands">Cayman Islands</option> <option value="Central African Republic ">Central African Republic </option> <option value="Chad">Chad</option> <option value="Chile">Chile</option> <option value="China">China</option> <option value="Christmas Island">Christmas Island</option> <option value="Cocos Islands">Cocos Islands</option> <option value="Colombia">Colombia</option> <option value="Comoros">Comoros</option> <option value="Congo">Congo</option> <option value="Congo, Democratic Republic of the">Congo, Democratic Republic of the</option> <option value="Cook Islands ">Cook Islands </option> <option value="Costa Rica">Costa Rica</option> <option value="Cote d">Cote d'Ivoire</option> <option value="Croatia">Croatia</option> <option value="Cuba">Cuba</option> <option value="Cyprus">Cyprus</option> <option value="Czech Republic">Czech Republic</option> <option value="Denmark">Denmark</option> <option value="Djibouti">Djibouti</option> <option value="Dominica">Dominica</option> <option value="Dominican Republic">Dominican Republic</option> <option value="Ecuador ">Ecuador </option> <option value="Egypt">Egypt</option> <option value="El Salvador">El Salvador</option> <option value="Equatorial Guinea">Equatorial Guinea</option> <option value="Eritrea">Eritrea</option> <option value="Estonia">Estonia</option> <option value="Ethiopia">Ethiopia</option> <option value="Falkland Islands">Falkland Islands</option> <option value="Faroe Islands">Faroe Islands</option> <option value="Fiji">Fiji</option> <option value="Finland">Finland</option> <option value="France ">France </option> <option value="French Guiana">French Guiana</option> <option value="French Polynesia">French Polynesia</option> <option value="Gabon">Gabon</option> <option value="Gambia">Gambia</option> <option value="Georgia">Georgia</option> <option value="Germany">Germany</option> <option value="Ghana">Ghana</option> <option value="Gibraltar">Gibraltar</option> <option value="Greece">Greece</option> <option value="Greenland">Greenland</option> <option value="Grenada">Grenada</option> <option value="Guadeloupe ">Guadeloupe </option> <option value="Guam">Guam</option> <option value="Guatemala">Guatemala</option> <option value="Guinea">Guinea</option> <option value="Guinea-Bissau">Guinea-Bissau</option> <option value="Guyana">Guyana</option> <option value="Haiti">Haiti</option> <option value="Heard Island and McDonald Islands">Heard Island and McDonald Islands</option> <option value="Honduras">Honduras</option> <option value="Hong Kong">Hong Kong</option> <option value="Hungary ">Hungary </option> <option value="Iceland">Iceland</option> <option value="India">India</option> <option value="Indonesia">Indonesia</option> <option value="Iran">Iran</option> <option value="Iraq">Iraq</option> <option value="Ireland">Ireland</option> <option value="Israel">Israel</option> <option value="Italy">Italy</option> <option value="Jamaica">Jamaica</option> <option value="Japan">Japan</option> <option value="Jordan">Jordan</option> <option value="Kazakhstan">Kazakhstan</option> <option value="Kenya">Kenya</option> <option value="Kiribati">Kiribati</option> <option value="Kuwait">Kuwait</option> <option value="Kyrgyzstan ">Kyrgyzstan </option> <option value="Laos">Laos</option> <option value="Latvia">Latvia</option> <option value="Lebanon">Lebanon</option> <option value="Lesotho">Lesotho</option> <option value="Liberia">Liberia</option> <option value="Libya">Libya</option> <option value="Liechtenstein">Liechtenstein</option> <option value="Lithuania">Lithuania</option> <option value="Luxembourg">Luxembourg</option> <option value="Macao">Macao</option> <option value="Madagascar">Madagascar</option> <option value="Malawi">Malawi</option> <option value="Malaysia">Malaysia</option> <option value="Maldives ">Maldives </option> <option value="Mali">Mali</option> <option value="Malta">Malta</option> <option value="Marshall Islands">Marshall Islands</option> <option value="Martinique">Martinique</option> <option value="Mauritania">Mauritania</option> <option value="Mauritius">Mauritius</option> <option value="Mayotte">Mayotte</option> <option value="Mexico">Mexico</option> <option value="Micronesia">Micronesia</option> <option value="Moldova">Moldova</option> <option value="Monaco">Monaco</option> <option value="Mongolia">Mongolia</option> <option value="Montenegro ">Montenegro </option> <option value="Montserrat">Montserrat</option> <option value="Morocco">Morocco</option> <option value="Mozambique">Mozambique</option> <option value="Myanmar">Myanmar</option> <option value="Namibia">Namibia</option> <option value="Nauru">Nauru</option> <option value="Nepal">Nepal</option> <option value="Netherlands">Netherlands</option> <option value="Netherlands Antilles">Netherlands Antilles</option> <option value="New Caledonia">New Caledonia</option> <option value="New Zealand">New Zealand</option> <option value=" Nicaragua"> Nicaragua</option> <option value="Niger">Niger</option> <option value="Nigeria">Nigeria</option> <option value="Norfolk Island">Norfolk Island</option> <option value="North Korea">North Korea</option> <option value="Norway">Norway</option> <option value="Oman">Oman</option> <option value="Pakistan">Pakistan</option> <option value="Palau">Palau</option> <option value="Palestinian Territory">Palestinian Territory</option> <option value="Panama">Panama</option> <option value=" Papua New Guinea"> Papua New Guinea</option> <option value="Paraguay">Paraguay</option> <option value="Peru">Peru</option> <option value="Philippines">Philippines</option> <option value="Pitcairn">Pitcairn</option> <option value="Poland">Poland</option> <option value="Portugal">Portugal</option> <option value="Puerto Rico">Puerto Rico</option> <option value="Qatar">Qatar</option> <option value="Romania">Romania</option> <option value="Russian Federation">Russian Federation</option> <option value="Rwanda ">Rwanda </option> <option value="Saint Helena">Saint Helena</option> <option value="Saint Kitts and Nevis">Saint Kitts and Nevis</option> <option value="Saint Lucia">Saint Lucia</option> <option value="Saint Pierre and Miquelon">Saint Pierre and Miquelon</option> <option value="Saint Vincent and the Grenadines">Saint Vincent and the Grenadines</option> <option value="Samoa ">Samoa </option> <option value="San Marino">San Marino</option> <option value="Sao Tome and Principe">Sao Tome and Principe</option> <option value="Saudi Arabia">Saudi Arabia</option> <option value="Senegal">Senegal</option> <option value="Serbia">Serbia</option> <option value="Seychelles">Seychelles</option> <option value="Sierra Leone">Sierra Leone</option> <option value="Singapore">Singapore</option> <option value="Slovakia">Slovakia</option> <option value="Slovenia ">Slovenia </option> <option value="Solomon Islands">Solomon Islands</option> <option value="Somalia">Somalia</option> <option value="South Africa">South Africa</option> <option value="South Georgia">South Georgia</option> <option value="South Korea">South Korea</option> <option value="Spain">Spain</option> <option value="Sri Lanka">Sri Lanka</option> <option value="Sudan">Sudan</option> <option value="Suriname">Suriname</option> <option value="Svalbard and Jan Mayen">Svalbard and Jan Mayen</option> <option value=" Swaziland"> Swaziland</option> <option value="Sweden">Sweden</option> <option value="Switzerland">Switzerland</option> <option value="Syrian Arab Republic">Syrian Arab Republic</option> <option value="Taiwan">Taiwan</option> <option value="Tajikistan">Tajikistan</option> <option value="Tanzania">Tanzania</option> <option value="Thailand">Thailand</option> <option value="The Former Yugoslav Republic of Macedonia ">The Former Yugoslav Republic of Macedonia </option> <option value="Timor-Leste">Timor-Leste</option> <option value="Togo">Togo</option> <option value="Tokelau">Tokelau</option> <option value="Tonga">Tonga</option> <option value="Trinidad and Tobago">Trinidad and Tobago</option> <option value="Tunisia">Tunisia</option> <option value="Turkey">Turkey</option> <option value="Turkmenistan">Turkmenistan</option> <option value="Tuvalu">Tuvalu</option> <option value="Uganda">Uganda</option> <option value="Ukraine">Ukraine</option> <option value="United Arab Emirates ">United Arab Emirates </option> <option selected="selected" value="United Kingdom">United Kingdom</option> <option value="United States">United States</option> <option value="United States Minor Outlying Islands">United States Minor Outlying Islands</option> <option value="Uruguay">Uruguay</option> <option value="Uzbekistan">Uzbekistan</option> <option value="Vanuatu">Vanuatu</option> <option value="Vatican City">Vatican City</option> <option value="Venezuela">Venezuela</option> <option value=" Vietnam"> Vietnam</option> <option value="Virgin Islands, British">Virgin Islands, British</option> <option value="Virgin Islands, U.S.">Virgin Islands, U.S.</option> <option value="Wallis and Futuna">Wallis and Futuna</option> <option value="Western Sahara">Western Sahara</option> <option value="Yemen">Yemen</option> <option value="Zambia">Zambia</option> <option value="Zimbabwe">Zimbabwe</option> </select></td> </tr> <tr> <td><span style="color: #ff0000;">*</span></td> <td>Telephone (Home):</td> <td><input id="telhome" type="text" name="telhome" value="" /></td> </tr> <tr> <td><span style="color: #ff0000;">*</span></td> <td>Telephone (Work):</td> <td><input id="telwork" type="text" name="telwork" value="" /></td> </tr> <tr> <td><span style="color: #ff0000;">*</span></td> <td>Telephone (Mobile):</td> <td><input id="telmobile" type="text" name="telmobile" value="" /></td> </tr> <tr> <td> </td> </tr> <tr> <td> </td> <td> </td> <td><label> <input id="button" type="submit" name="button" value="Submit" /> </label></td> </tr> </tbody> </table> </form> <?php /* Set e-mail recipient */ $myemail = "myemail@gmail.com"; /* Check all form inputs using check_input function */ $clentEmail = check_input($_POST['clentEmail']); $yourname = check_input($_POST['clentFname'], "Enter your name"); $clentLname = check_input($_POST['clentLname'], "Enter your last name"); $lastname = check_input($_POST['lastname'], "Write your last name"); $Country2 = check_input($_POST['Country2'], "Your Country"); $email2 = check_input($_POST['email2'], "Enter your email"); $Title = check_input($_POST['Title']); $FirstName = check_input($_POST['FirstName'], "Enter your name222"); $LastName = check_input($_POST['LastName'], "Enter your last name"); $Country = check_input($_POST['Country'], "Your Country"); $telhome = check_input($_POST['telhome'], "Enter your home nomber"); $telwork = check_input($_POST['telwork'], "Enter your work nomber"); $telmobile = check_input($_POST['telmobile'], "Enter your mobile nomber"); /* If e-mail is not valid show error message */ if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email)) { show_error("E-mail address not valid"); } /* If URL is not valid set $website to empty */ if (!preg_match("/^(https?:\/\/+[\w\-]+\.[\w\-]+)/i", $website)) { $website = ''; } /* Let's prepare the message for the e-mail */ $message = "Hello! Your contact form has been submitted by: Client Name: $clentFname Client Last Name: $clentLname Client E-mail: $email Client Country: $Country2 Friend Detail: E-mail: $email2 Title: $Title First Name: $FirstName Last Name: $LastName Country: $Country Home Nomber: $telhome Work Nomber: $telwork Mobile Nomber: $telmobile End of message "; /* Send the message using mail() function */ mail($myemail, $subject, $message); /* Redirect visitor to the thank you page */ header('Location: '); exit(); /* Functions we used */ function check_input($data, $problem='') { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); if ($problem && strlen($data) == 0) { show_error($problem); } return $data; } function show_error($myError) { ?> <html> <body> <b>Please correct the following error:</b><br /> <?php echo $myError; ?> </body> </html> <?php exit(); } ?> Hey everyone, I just started using php a couple days ago and I've run into an issue. This is also my first time coding anything, so even basic things are a bit difficult for me. What I have posted below is an html form with 5 fields. After typing values (into as many or as little fields as you want) and hitting "submit", the form will echo how many values you've entered (integers, strings, whatever, it'll add one to the counter as long as the value isn't negative). The values will also remain in the form after being submitted (this is intentional, and actually what I'm after). This is working just fine. What I'm trying to add is an option to switch between a maximum of either 5 fields (rows), or 10 fields. The code below manages to do this, and actually return the correct result after hitting "submit". Unfortunately, it won't "hold onto" any of the values I enter past the original 5 fields. So for example if I switch to 10 fields, and enter "1, 2, 3, 4, 5, 6, and 7" into the fields, it will display "7 items", however, only the "1, 2, 3, 4, and 5" will remain in their respective fields, while the "6, and 7" will disappear. So, two questions. First, how do I fix that? And second, what's actually the best way for me to do what I'm trying to do? Because I'm guessing I've come up with a pretty bad newbie hacked-together way of doing it (Note: This is all part of a larger function that has proper data sanitation and etc, I just cut it down for this example.) Thanks! Edit: I'd also like to add I ideally want this entirely in php (no javascript) for compatibility reasons. <?php // rows.php $a[1] = $a[2] = $a[3] = $a[4] = $a[5] = $a[6] = $a[7] = $a[8] = $a[9] = $a[10] = $rows = $r10 = ''; $r5 = 'checked'; if ($r5 == 'checked') { $start_r_cnt = 1; $end_r_cnt = 5; } if (isset($_POST['rows'])) { $check_radio = $_POST['rows']; if ($check_radio == 'r10') { $r10 = 'checked'; $start_r_cnt = 1; $end_r_cnt = 10; for ($i=6;$i<=$end_r_cnt;$i++) { $value = "$a[$i]"; $rows = $rows.'<tr><td><input type="text" name="a'.$i.'" size="10" value="'.$value.'"/></td></tr>'; $value = $a[$i]; } } } $count_a = 0; $value_error = ''; for($i=1;$i<=$end_r_cnt;$i++) { if(isset($_POST['a'.$i])) { $a[$i] = $_POST['a'.$i]; if($a[$i] == '') { $a[$i] == ''; } elseif($a[$i] >= 0) { $count_a++; } elseif ($a[$i] < 0) { $value_error = 'One of the entered values is negative. Please fix this before continuing.'; } } } echo <<<_END <html> <form method="post" action="rows.php"> <table cellpadding="5"> <b>Number of Rows:</b><br> <input type="submit" name="rows" value="Change" style="width: 70px" /> [5]<input type='radio' name='rows' value='r5' $r5/>[10]<input type='radio' name='rows' value='r10' $r10/> <tr><td><center>Data A</center></td></tr> <tr><td><input type="text" name="a1" size="10" value='$a[1]'/></td></tr> <tr><td><input type="text" name="a2" size="10" value='$a[2]'/></td></tr> <tr><td><input type="text" name="a3" size="10" value='$a[3]'/></td></tr> <tr><td><input type="text" name="a4" size="10" value='$a[4]'/></td></tr> <tr><td><input type="text" name="a5" size="10" value='$a[5]'/></td></tr> $rows <tr><td><center><input type="submit" value="Submit" style="width: 80px" /></center></td></tr> </table> <b>$count_a</b> items are present. <b>$value_error</b> </html> _END; ?> I'm building a php program that registers users onto a website. With the help of people from this thread http://www.phpfreaks.com/forums/index.php?topic=332260.15 I was able to accomplish the goal and now the signup works with conditions that check for a valid email, and if the password is strong enough. T he program correctly displays the the problem when a user does NOT enter a valid email, or a strong enough password, but the user has to re-enter the email and password everytime. I want to make it so that the fields remained populated with what the user entered previously, so he or she does not have to re-enter his or her email/password. Here is the code (its really ghetto) Code: [Select] <?php function check_email_address($email) { // First, we check that there's one @ symbol, and that the lengths are right if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { // Email invalid because wrong number of characters in one section, or wrong number of @ symbols. return false; } // Split it into sections to make life easier $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for ($i = 0; $i < sizeof($local_array); $i++) { if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { return false; } } if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) { return false; // Not enough parts to domain } for ($i = 0; $i < sizeof($domain_array); $i++) { if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { return false; } } } return true; } define('DB_NAME', 'catch'); define('DB_USER', 'username'); define('DB_PASS', 'password'); define('DB_HOST', 'page.sqlserver.com'); // contact to database $connect = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die('Error , check your server connection.'); mysql_select_db(DB_NAME); //Get data in local variable $v_name=$_POST['name']; $v_email=$_POST['email']; $v_msg=$_POST['msg']; if ( check_email_address($_POST['name']) == false) { $query = "INSERT INTO contact(name,email,msg) VALUES ('$v_name','$v_email','$v_msg')"; $result = mysql_query( $query ); if( !$result ) { die( mysql_error() ); } echo <<<EOD <head> <link rel="stylesheet" type="text/css" href="http://hedgezoo.com/signup.css"> </head> <h2>Free Registration</h2> <form action="contact_insert2.php" method="POST" id="insert"> <table> <tr> <td>Email</td> <td ><input type="text" size="40" name="name"></td> </tr> <tr> <td>Password</td> <td><input type="password" size="40" name="msg" ></td> </tr> <tr> <td colspan=2 id="sub"> You must enter a valid email. <br /> <input type="submit" name="submit" value="submit"> </td> </tr> </Table> </form> EOD; } if( $v_name == "" || $v_msg == "" ) // if name is empty or if pass is empty { $query = "INSERT INTO contact(name,email,msg) VALUES ('$v_name','$v_email','$v_msg')"; $result = mysql_query( $query ); if( !$result ) { die( mysql_error() ); } echo <<<EOD <head> <link rel="stylesheet" type="text/css" href="http://hedgezoo.com/signup.css"> </head> <h2>Free Registration</h2> <form action="contact_insert2.php" method="POST" id="insert"> <table> <tr> <td>Email</td> <td ><input type="text" size="40" name="name"></td> </tr> <tr> <td>Password</td> <td><input type="password" size="40" name="msg" ></td> </tr> <tr> <td colspan=2 id="sub"> You must enter an email and password. <br /> <input type="submit" name="submit" value="submit"> </td> </tr> </Table> </form> EOD; } if( strcspn( $_REQUEST['msg'], '0123456789' ) == strlen( $_REQUEST['msg'] ) ) // the above statement says if pass does not contain a number { $query = "INSERT INTO contact(name,email,msg) VALUES ('$v_name','$v_email','$v_msg')"; $result = mysql_query( $query ); if( !$result ) { die( mysql_error() ); } echo <<<EOD <head> <link rel="stylesheet" type="text/css" href="http://hedgezoo.com/signup.css"> </head> <h2>Free Registration</h2> <form action="contact_insert2.php" method="POST" id="insert"> <table> <tr> <td>Email</td> <td ><input type="text" size="40" name="name"></td> </tr> <tr> <td>Password</td> <td><input type="password" size="40" name="msg" ></td> </tr> <tr> <td colspan=2 id="sub"> <div style="color:red;">Your password must contain a number.</div> <br /> <input type="submit" name="submit" value="submit"> </td> </tr> </Table> </form> EOD; } if( strlen($_POST['msg']) < 8 ) // the above statement says if pass is not 8 characters long { $query = "INSERT INTO contact(name,email,msg) VALUES ('$v_name','$v_email','$v_msg')"; $result = mysql_query( $query ); if( !$result ) { die( mysql_error() ); } echo <<<EOD <head> <link rel="stylesheet" type="text/css" href="http://hedgezoo.com/signup.css"> </head> <h2>Free Registration</h2> <form action="contact_insert2.php" method="POST" id="insert"> <table> <tr> <td>Email</td> <td ><input type="text" size="40" name="name"></td> </tr> <tr> <td>Password</td> <td><input type="password" size="40" name="msg" ></td> </tr> <tr> <td colspan=2 id="sub"> <div style="color:red;">Your password must be at least 8 characters long.</div> <br /> <input type="submit" name="submit" value="submit"> </td> </tr> </Table> </form> EOD; } if ( $_POST['msg'] == strtolower($_POST['msg']) ) // the above statement says if pass is all lowercase { $query = "INSERT INTO contact(name,email,msg) VALUES ('$v_name','$v_email','$v_msg')"; $result = mysql_query( $query ); if( !$result ) { die( mysql_error() ); } echo <<<EOD <head> <link rel="stylesheet" type="text/css" href="http://hedgezoo.com/signup.css"> </head> <h2>Free Registration</h2> <form action="contact_insert2.php" method="POST" id="insert"> <table> <tr> <td>Email</td> <td ><input type="text" size="40" name="name"></td> </tr> <tr> <td>Password</td> <td><input type="password" size="40" name="msg" ></td> </tr> <tr> <td colspan=2 id="sub"> <div style="color:red;">Your password must have at least one capital letter.</div> <br /> <input type="submit" name="submit" value="submit"> </td> </tr> </Table> </form> EOD; } if ( preg_replace("/[^a-zA-Z0-9\s]/", "", $_POST['msg']) == $_POST['msg'] ) // the above statement says if pass contains no special characters { $query = "INSERT INTO contact(name,email,msg) VALUES ('$v_name','$v_email','$v_msg')"; $result = mysql_query( $query ); if( !$result ) { die( mysql_error() ); } echo <<<EOD <head> <link rel="stylesheet" type="text/css" href="http://hedgezoo.com/signup.css"> </head> <h2>Free Registration</h2> <form action="contact_insert2.php" method="POST" id="insert"> <table> <tr> <td>Email</td> <td ><input type="text" size="40" name="name"></td> </tr> <tr> <td>Password</td> <td><input type="password" size="40" name="msg" ></td> </tr> <tr> <td colspan=2 id="sub"> <div style="color:red;">Your password must have at least one special character.</div> <br /> <input type="submit" name="submit" value="submit"> </td> </tr> </Table> </form> EOD; } else echo <<<EOD <B>GO FUCK YOURSELF</B> EOD; ?> Hello everyone, I am having a problem since some time now and need some help. I have created a login page where the user has to input a username and password to login. The username will be put in a session and when the user logs out the session data and session itself gets destroyed. However when I go back in the browser history to the page where I logged in I get the "famous" resend information dialog that asks you to resend the information from the login form. Which means that all the post data gets resend and the user logs in again without having to put in a username and password. Here is my code: Login.tpl: Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Snitch</title> <link rel="stylesheet" type="text/css" href="templates/css/snitch1440x900.css" /> </head> <body> <div id="login-achtergrond"> <div id="login"> <form action="." id="loginform" name="login" method="post"> <input type="hidden" name="actie" value="Login"></input> <input type="text" id="username" name="username" value="" style="opacity:0.7;filter:alpha(opacity=70)"></input> <input type="password" id="password" name="password" value="" style="opacity:0.7;filter:alpha(opacity=70)"></input> <input id="aanmelden" type="submit" name="submit" value="" style="opacity:0;filter:alpha(opacity=0)"> </form> </div> <div id="registreer"> </div> </div> </body> </html> Here is the code of my login page (I created this in a OOP way): Code: [Select] <?php class Handler_Login extends Actie_Handler { function __construct($actie_handle) { parent::construct($actie_handle); $this->actie = $actie_handle; } function secured_handler() { if ($this->session->check_session() == false) { $password = $_POST['password']; $username = $_POST['username']; $login = $this->dbh->Login($username, $password); if ($login == true) { $this->session->set('username', $username); $this->view->displayHome(); $this->view->display(); } else { echo "You are not logged in!"; } unset($_POST['password']); unset($_POST['username']); } if ($this->session->check_session() == true) { $this->view->displayHome(); $this->view->display(); } } } ?> Here is the code of my logout: Code: [Select] <?php class Handler_Loguit extends Actie_Handler { function __construct($actie_handle) { parent::construct($actie_handle); $this->actie = $actie_handle; } function secured_handler() { $this->session->stopSession(); $this->view->displayLogin(); $this->view->display(); } } ?> Here is the code of my session: Code: [Select] <?php class Session { function __construct() { if(!isset($_SESSION)) { session_start(); } } function set($name, $value) { $_SESSION[$name] = $value; } function get($name) { return $_SESSION[$name]; } function stopSession() { $_SESSION = array(); //even though I don't use any cookies someone told me that I had to remove the cookie of the session to completely destroy it? //please tell me if this is correct if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } session_destroy(); } function session_message($naam) { return print_r($_SESSION[$naam]); } function check_session() { if(isset($_SESSION['username']) && !empty($_SESSION['username'])) { return true; } else { return false; } } } ?> this is the code of my view for those who might be interested: Code: [Select] <?php class view_manager { private $tpl; function __construct() { } function displayStatus() { $status = file_get_contents("templates/status.tpl"); $this->tpl = str_replace("%content%", $status, $this->tpl); } function displayLogin() { $this->tpl = file_get_contents("templates/login.tpl"); } function displayHome() { $this->tpl = file_get_contents("templates/home.tpl"); } function display() { echo $this->tpl; } } ?> using a header to redirect to the login page is not going to work since I use my view_manager to display the pages. Does anyone know of any solution to get rid of that stupid resend information dialog without using a header? I tryed unsetting the values of POST in my login code but that did not seem to work. Please help me out I've been looking for an answer for over 1 and a half week so far Is there anyone who knows how to remove the POST data from a form when the user goes back in browser history? If it's not possible, is there any solution except using a header? ok so this problem has been laughing at me for quite some time now I tryed using some inline php in a form to pass it to my login script. The problem is that whenever the form gets submitted the variable r doesn't contain the actual microtime but it contains the inline php as a string: Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Snitch</title> <link rel="stylesheet" type="text/css" href="templates/css/snitch1440x900.css" /> </head> <body> <div id="login-achtergrond"> <div id="login"> <form action="." id="loginform" name="login" method="post"> <input type="hidden" name="actie" value="Login"></input> <input type="hidden" name="r" value="<?php echo microtime();?>"></input> <input type="text" id="gebruikersnaam" name="gebruikersnaam" value="" style="opacity:0.7;filter:alpha(opacity=70)"></input> <input type="password" id="paswoord" name="paswoord" value="" style="opacity:0.7;filter:alpha(opacity=70)"></input> <input id="aanmelden" type="submit" name="submit" value="" style="opacity:0;filter:alpha(opacity=0)"> </form> </div> <div id="registreer"> </div> </div> </body> </html> the $_POST['r']; contains "<?php echo microtime();?>" instead of for example: 0.53192500 1305636839 does someone know what I am doing wrong here? I also tryed doing it like this: Code: [Select] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Snitch</title> <link rel="stylesheet" type="text/css" href="templates/css/snitch1440x900.css" /> </head> <body> <div id="login-achtergrond"> <div id="login"> <form action=".r=<?php echo microtime();?>" id="loginform" name="login" method="post"> <input type="hidden" name="actie" value="Login"></input> <input type="text" id="gebruikersnaam" name="gebruikersnaam" value="" style="opacity:0.7;filter:alpha(opacity=70)"></input> <input type="password" id="paswoord" name="paswoord" value="" style="opacity:0.7;filter:alpha(opacity=70)"></input> <input id="aanmelden" type="submit" name="submit" value="" style="opacity:0;filter:alpha(opacity=0)"> </form> </div> <div id="registreer"> </div> </div> </body> </html> both $_POST and $_GET contains a string instead of the actual microtime single quotes didn't work eather I am fairly new to PHP and am having an issue with getting my form to redirect to a thank you page upon sending the form email. I currently have it set to echo a thank you message but it needs to be changed to ensure that we can track all form fills better. I have tried the header method but it doesn't work correctly based on how the website is designed. It seems like there should be an easy way without redesigning too much. Are there any other ways to accomplish this? Please let me know what I need to do in order to get the redirect to work. Hopefully I can explain this well. I have a list, which is linked he http://hoosierhoopsreport.com/test-11-rank/ When I'm done, I'm trying to set up the list I, as ADMIN, can make changes to the list without having to go into my database. I'm mostly concerned with the # column, but once we get through this, I can apply what I've learned. I'm setting the form to print # and school as text fields. I'm getting id, nameFirst and nameLast as hidden values to pass to my form handler. When I hit submit, I'm getting this error: Quote You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE id='172'' at line 5 Query: UPDATE wp_playerRank_copy SET rankClass='10', hschool='Avon HS', WHERE id='172' I'm pretty sure it's just filtering through the information to most last piece of data handled, which isn't what I want, but I also don't understand why I'm getting the error. Here is the code dealing with the form: Code: [Select] <form id="class2011" action="/resources/form/dbplayerUpdate.php" method="post"> <table class="playerTable" border="0" width="100%"> <thead> <tr> <th class="num">#</th> <th class="top">Top 10</th> <th class="height">HT</th> <th class="pos">POS</th>'; if (current_user_can("access_s2member_level4")){ echo '<th class="level">Level</th>'; } echo '<th class="school">City (School)</th>'; if (current_user_can("access_s2member_level4")){ echo '<th class="summer">Summer Team</th>'; } echo '<th class="college">College</th> </tr> </thead> <tfoot> <tr> <td colspan="8" align="right">(+) moved up; (d) debut; (s) switched from another position / <b>Colleges in bold print means committed</b></td> </tr> <tr> <td><input id="Submit" name="Submit" type="submit" value="Submit" /></td> </tr> </tfoot> <tbody>';$query = 'SELECT * FROM wp_playerRank_copy WHERE year="2011" ORDER BY rankClass ASC'; $results = mysql_query($query); while($line = mysql_fetch_assoc($results)) { if ($line['rankClass'] != 0) { echo ' <tr> <td> <input type="hidden" name="db_id" value="' . $line['id'] . '"size="2"> <input type="text" name="rankClass" value="' . $line['rankClass'] . '"size="2">' . $line['devClass'] .'</td> <td>'; if ($line['wpID'] > '0') { echo ' <input type="hidden" name="nameFirst" value="' . $line['nameFirst'] . '"size="2"> <input type="hidden" name="nameLast" value="' . $line['nameLast'] . '"size="2"> <a href="/tag/' . $line['nameFirst'] . '-' . $line['nameLast'] .'">'. $line['nameFirst'] . ' ' . $line['nameLast'] . '</a>'; } else { echo $line['nameFirst'] . ' ' . $line['nameLast']; } echo '</td><td>'. $line['height'] . '</td> <td>'. $line['position'] . '</td>'; if (current_user_can("access_s2member_level4")){ echo '<td>'. $line['level'] . '</td>'; } echo '<td><input type="text" name="hschool" value="' . $line['hschool'] .'"size="30"></td>'; if (current_user_can("access_s2member_level4")){ echo '<td>'. $line['summer'] . '</td>'; } if ($line['committed'] == 'y') { echo ' <td><strong>'. $line['college'] . '</strong></td> ';} echo '</tr> ';} } echo ' </tbody></table></form> Here is the form handler: Code: [Select] if(!$con = mysql_connect("localhost","jwrbloom_","redcoach")) { die("Could not connect to database: ".mysql_error()); } mysql_select_db("jwrbloom_wpHHR", $con); $nameFirst = $_POST['nameFirst']; $nameLast = $_POST['nameLast']; $db_id = $_POST['db_id']; $rankClass = $_POST['rankClass']; $hschool = $_POST['hschool']; //$grade = $_POST['grade']; //$coachSchool = $_POST['coachSchool']; //$feet = $_POST['feet']; //$inches = $_POST['inches']; /* search for existing row */ $sql = "SELECT id FROM wp_playerRank_copy WHERE nameFirst='".mysql_real_escape_string($nameFirst)."' AND nameLast='".mysql_real_escape_string($nameLast)." '"; if(!$result = mysql_query($sql)) { die(mysql_error()."<br />Query: ".$sql); } if(mysql_num_rows($result)) { $row = mysql_fetch_assoc($result); /* update existing row */ $sql = "UPDATE wp_playerRank_copy SET rankClass='".mysql_real_escape_string($rankClass)."', hschool='".mysql_real_escape_string($hschool)."', WHERE id='".$row['id']."'"; if(!$result = mysql_query($sql)) { die(mysql_error()."<br />Query: ".$sql); } } Amazingly, PHP Coding Help != JavaScript Help. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=333336.0 I have an exercise for school that I have to work out. My teacher is letting us figure it out ourselves, but I've ran into some troubles: - We have to make 2 files: sescook1.php and sescook2.php. - We have to make a form for the user to fill out their name and favorite color (in sescook1.php). - We have to check the input (whether there is input or no). If there's isn't any input, we have to echo 'Please fill out __' (in sescook1.php) - We have to store the name in a session variable and the color in a cookievariable (in sescook1.php) - If both fields are filled in, we ave to show a link 'go to the next page' (where 'next page' is an URL to sescook2.php). - All info has to be shown in sescook2.php (Entered name: __, Entered color: ___) - You have a link 'Go back to previous page' (where 'previous page' is an URL to sescook1.php) My code: Quote <?php session_start(); function checkContent() { if($_POST["name"] == "") echo "Please enter your name"; elseif($_POST["favcolor"]) echo "Please enter your favorite color"; else echo "Go to <a href='http://localhost/webadv1011/PHPCookiesSessies/sescook2.php'>next page"; } ?> <form name="color" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>" onsubmit="<?php checkContent(); ?>"> <p>Name: <input type="text" name="naam" /></p> <p>Favourite color: <input type="text" name="favcolor" /></p> <p><input type="submit" name="submit" value="send" /></p> </form> This is the code I got so far. My problem is that the page refreshes itself after it does the checkContent function. I'm also not sure how I save my name in a session variable and the color in a cookie variable (and pass them to the next page as well!). We haven't learned anything on cookies and sessions except our own trial and error and things I found on the internet. Unfortunately, I can't really find lots of useful info (most people refer to Ajax, but we can only use php), or I'm looking in the wrong place. Thanks for your help in advance! Good afternoon all!! I have a very specific issue that, in my opinion, is quite complicated. In words, here is what I wish to achieve. I would like a page which displays users from the database. Each individual user has their own Div hidden below their name. Within this div, there is a form. The form is full of radio buttons. Once the user's name is clicked and form submitted, I wish to write the form data to the database for the specific user that was selected. See below example for better understanding: Dale Gibbs Chris Hansen Steve Jobs If I click Chris Hansen, the following happens Dale Gibbs ============== Chris Hansen HIDDEN DIV FORM CONTENT HIDDEN DIV FORM CONTENT HIDDEN DIV FORM CONTENT HIDDEN DIV FORM CONTENT HIDDEN DIV FORM CONTENT Submit Button ============== Steve Jobbs So as of now, the display is correct. I am seeing exactly what I want to see from my database. Also, my div IDs work just fine as well as the Javascript toggleSlidebox function. The only issue is for some reason, whenever I submit the form (no matter which user I select from my list), I can only write to the last inputted ID. So for example, if the last ID entered into the database was 6, then thats the only ID that will be returned when my form is submitted and the only place data will be written to, even if I select a user with ID 2. Please see below code for more information Code: [Select] <?php $staff_display_query = "SELECT staff_info.id, staff_info.fname, staff_info.lname FROM staff_info, staff_projects WHERE staff_info.id = staff_projects.staff_id AND staff_projects.proj_id = '$c_project_id'"; $staff_display_sql = mysql_query($staff_display_query) or die (mysql_error()); while ($row = mysql_fetch_array($staff_display_sql)) { $current_staff_id = $row['id']; $staff_fname = $row['fname']; $staff_lname = $row['lname']; $list_staff .= ' ' . $current_staff_id . '<br /> <a href="#" onclick="return false" onmousedown="javascript:toggleSlideBox(' . $current_staff_id . ');">' . $staff_fname . ' ' . $staff_lname . '</a> <div class="hiddenDiv" id="' . $current_staff_id . '" style="border:#FFF 2px solid; width:553px;"> <!--TASK 1--> <div id="task_1_permissions" class="task_permissions"> <input name="permissions_1" type="radio" value="1"/> <input name="permissions_1" type="radio" value="2" /> <input name="permissions_1" type="radio" value="3" /> <input name="permissions_1" type="radio" value="0" /> </div> <!--TASK 2--> <div id="task_2_permissions" class="task_permissions"> <input name="permissions_2" type="radio" value="1"/> <input name="permissions_2" type="radio" value="2" /> <input name="permissions_2" type="radio" value="3" /> <input name="permissions_2" type="radio" value="0" /> </div> <!--TASK 3--> <div id="task_3_permissions" class="task_permissions"> <input name="permissions_3" type="radio" value="1"/> <input name="permissions_3" type="radio" value="2" /> <input name="permissions_3" type="radio" value="3" /> <input name="permissions_3" type="radio" value="0" /> </div> <!--TASK 4--> <div id="task_4_permissions" class="task_permissions"> <input name="permissions_4" type="radio" value="1"/> <input name="permissions_4" type="radio" value="2" /> <input name="permissions_4" type="radio" value="3" /> <input name="permissions_4" type="radio" value="0" /> </div> <input name="submit_user_permissions" type="submit" value="Submit Permissions" /> </div> </div> <br /><br /> '; } if (isset($_POST['submit_user_permissions'])) { $permissions_1 = $_POST['permissions_1']; $permissions_2 = $_POST['permissions_2']; $permissions_3 = $_POST['permissions_3']; $permissions_4 = $_POST['permissions_4']; $query = "UPDATE staff_projects SET task_1='$permissions_1', task_2='$permissions_2', task_3='$permissions_3', task_4='$permissions_4' WHERE proj_id='$c_project_id' AND staff_id='$current_staff_id'"; $sql = mysql_query($query) or die (mysql_error()); echo 'Permissions set successfully.<br />'; } After this PHP I have my standard HTML. Below is the javascript function I use for the slide box: Code: [Select] <script src="js/jquery-1.5.js" type="text/javascript"></script> <script language="javascript" type="text/javascript"> function toggleSlideBox(x) { if ($('#'+x).is(":hidden")) { $(".hiddenDiv").slideUp(200); $('#'+x).slideDown(300); } else { $('#'+x).slideUp(300); } } </script> Javascript works just fine by the way. Below is the form I have in the HTML of the code. Code: [Select] <form action="" method="post" enctype="multipart/form-data"> <?php echo "$list_staff"; ?> </form> This is of course wrapped around body tags and all the other necessary HTML. The view of the form is working right, the functions within the form are also working correctly. I just cant seem to separate the variables for each individual user. If I am in Chris Hansen's div, it should be his ID number that is being referenced for the database, not the ID number of the last person entered into the system. Any ideas? As always, thanks in advance guys!!! Bl4ck Maj1k |