-
Posts
530 -
Joined
-
Last visited
Everything posted by lovephp
-
got it mate at last thanks alot \m/
-
i dont know its all messup it still would not show the results like i want it to sob
-
friend i am trying to display the data like this company Names Phone Numbers some name 1 number 1 number 2 number 3 number 4 some name 2 number 1 number 2 number 3 number 4 some name 3 number 1 number 2 number 3 number 4 echo '<table align="center" width="500" border="1">'; echo '<tr>'; echo '<th scope="col">Company Names</th>'; echo '<th scope="col">Transfer Numbers</th>'; echo '</tr>'; $data1=mysql_query("select cat_id, category from company_names"); while($info1=mysql_fetch_array($data1)) { $id = $info1[0]; $comp = $info1[1]; echo '<tr>'; echo "<td><font size='4' color='#FF3300'>".$comp."</font> <a href ='del-comp.php?id=$id'><img src='del.jpg' alt='Delete' height='13' width='13' title='Delete'></a><br/></td>"; $data2=mysql_query("select cat_id, subcategory from company_numbers where cat_id=' $id '"); while($info2=mysql_fetch_array($data2)) { $cat_id = $info2['0']; $nums = $info2['1']; echo "<td><font size='2' color='blue'>".$nums."</font> <a href ='del-num.php?id=$id&num=$nums'><img src='del.jpg' alt='Delete' height='8' width='8' title='Delete'></a></td>"; echo '</tr>'; } } echo '</table>'; but it does not show like i want it could someone help?
-
help please, unable to search 2 words together
lovephp replied to lovephp's topic in PHP Coding Help
it did not work out brother, no result shows. any help? -
help please, unable to search 2 words together
lovephp replied to lovephp's topic in PHP Coding Help
thanks bro and yes i do use escape strings but just to show here i removed it all to make it simple. ill give it a try with what you gave me hope it sorts my problem. i have never made a search script before so im clueless -
help please, unable to search 2 words together
lovephp replied to lovephp's topic in PHP Coding Help
or say this query SELECT * FROM $tableName WHERE customerName LIKE '%".$srcquery."%' OR homePhone LIKE '%".$srcquery."%' OR comments LIKE '%".$srcquery."%' ORDER BY id DESC i enter peter i get result i enter peter smith nothing show i enter smith then result shows again. -
friends in my db table say like customerName holds First and the Last name but in my search if i enter the first name then record shows but if i try to search by entering both First and the Last name in the textbox i do not get any results why? here the query $srcquery = $_REQUEST['srcquery']; $query = "SELECT COUNT(*) as num FROM $tableName WHERE customerName LIKE '%".$srcquery."%' OR homePhone LIKE '%".$srcquery."%' OR comments LIKE '%".$srcquery."%' AND agent = '".$logged."' ORDER BY id DESC";
-
functions.php <?php function formError($p){ $errormsg = array(); if($p['name'] == '') { $errormsg['name'] = 'Name is required!'; } if($p['email'] == '') { $errormsg['email'] = 'E-mail is required!'; }else if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $p['email'])) { $errormsg['email'] = 'E-mail is not valid!'; } return $errormsg; } ?> sendmail.php <?php include ("functions.php"); if(count($_POST)){ $f = $_POST; $error = formError($f); if(count($error) == 0) { $EmailTo = "me@me.com"; $Subject = "Request Form"; $Name = Trim(stripslashes($_POST['name'])); $Company = Trim(stripslashes($_POST['company'])); $Tel = Trim(stripslashes($_POST['phone'])); $Email = Trim(stripslashes($_POST['email'])); $Website = Trim(stripslashes($_POST['website'])); $Meeting = $_POST['meeting']; $Services = Implode("\n", $_POST['services']); $Message = Trim(stripslashes($_POST['message'])); $mailheader .= "Reply-To: $Email \r\n"; // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Company: "; $Body .= $Company; $Body .= "\n"; $Body .= "Phone: "; $Body .= $Tel; $Body .= "\n"; $Body .= "Email: "; $Body .= "$Email"; $Body .= "\n"; $Body .= "Website: "; $Body .= $Website; $Body .= "\n\n"; $Body .= "Preferred Meeting Type: \n"; $Body .= $Meeting; $Body .= "\n\n"; $Body .= "I'm Interested In: \n"; $Body .= $Services; $Body .= "\n\n"; $Body .= "Message: \n"; $Body .= $Message; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$Email>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=thanks.html\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } } } ?> <form method="post" action="sendmail.php"> <fieldset> <legend>Contact Information:</legend> <div> <label>Name*</label> <input name="name" type="text" required="required"/> <?php if($error['name'] !='') { echo '<div class="error_msg">'.$error['name'].'</div>'; } ?> <br /> </div> <div> <label>Company Name</label> <input name="company" type="text"/> <br /> </div> <div> <label>Phone Number</label> <input name="phone" type="tel" /> <br /> </div> <div> <label>Email Address*</label> <input name="email" type="email" required="required" /> <?php if($error['email'] !='') { echo '<div class="error_msg">'.$error['email'].'</div>'; } ?> <br /> </div> <div> <label>Website Address</label> <input name="website" type="url" /> <br /> </div> </fieldset> <fieldset> <legend>Preferred Meeting Type:</legend> <div> <label> </label> <input type="radio" name="meeting" value="Go To Meeting" /> <span class="checkboxDesc">Set Up A Go To Meeting Online Demo</span><br /> <label> </label> <input type="radio" name="meeting" value="Face To Face" /> <span class="checkboxDesc">Contact Me About A Face-To-Face Meeting</span><br /> <label> </label> <input type="radio" name="meeting" value="Would Like More Information" /> <span class="checkboxDesc">More Information</span><br /> </div> </fieldset> <fieldset> <legend>I'm Interested In:</legend> <div> <label>Request Information On:</label> <input type="checkbox" name="services[]" value="Call Tracking Telephone Numbers" /> <span class="checkboxDesc">Call Tracking Telephone Numbers</span><br /> <input type="checkbox" name="services[]" value="Design, Print & Mail Direct Mail Packages" /> <span class="checkboxDesc">Design, Print & Mail Packages</span><br /> <input type="checkbox" name="services[]" value="Direct Mail List Purchase" /> <span class="checkboxDesc">Direct Mail List Purchase</span><br /> <input type="checkbox" name="services[]" value="Printing & Graphic Design Services" /> <span class="checkboxDesc">Printing & Graphic Design Services</span><br /> <input type="checkbox" name="services[]" value="Website Design Services" /> <span class="checkboxDesc">Website Design Services</span><br /> <input type="checkbox" name="services[]" value="QR Codes & Landing Pages" /> <span class="checkboxDesc">QR Codes & Landing Pages</span><br /> <input type="checkbox" name="services[]" value="Mobile Websites" /> <span class="checkboxDesc">Mobile Websites</span><br /> <input type="checkbox" name="services[]" value="Sales & Lead Tracking Software" /> <span class="checkboxDesc">Sales & Lead Tracking Software</span><br /> <input type="checkbox" name="services[]" value="Marketing & Sales Consulting Services" /> <span class="checkboxDesc">Marketing & Sales Consulting Services</span><br /> </div> <div> <label>Message</label> <textarea name="message" id="message" rows="5" required="required" /> </textarea> </div> </fieldset> <input type="submit" name="submit" value="Submit" class="button" /> </form>
-
u could use array to display error msgs on the form google and see there are loads of examples
-
try this and see <?php if(isset($_POST['submit'])){ if(empty($_POST['name']) || empty($_POST['email'])){ echo 'Name and E-mail is required'; }else{ $EmailTo = "me@me.com"; $Subject = "Request Form"; $Name = Trim(stripslashes($_POST['name'])); $Company = Trim(stripslashes($_POST['company'])); $Tel = Trim(stripslashes($_POST['phone'])); $Email = Trim(stripslashes($_POST['email'])); $Website = Trim(stripslashes($_POST['website'])); $Meeting = $_POST['meeting']; $Services = Implode("\n", $_POST['services']); $Message = Trim(stripslashes($_POST['message'])); $mailheader .= "Reply-To: $Email \r\n"; // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Company: "; $Body .= $Company; $Body .= "\n"; $Body .= "Phone: "; $Body .= $Tel; $Body .= "\n"; $Body .= "Email: "; $Body .= "$Email"; $Body .= "\n"; $Body .= "Website: "; $Body .= $Website; $Body .= "\n\n"; $Body .= "Preferred Meeting Type: \n"; $Body .= $Meeting; $Body .= "\n\n"; $Body .= "I'm Interested In: \n"; $Body .= $Services; $Body .= "\n\n"; $Body .= "Message: \n"; $Body .= $Message; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$Email>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=thanks.html\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } } } ?>
-
Display Db Records Of The Current Month Only How?
lovephp replied to lovephp's topic in PHP Coding Help
totally agreed i messed it up in the first place next time onwards ill make sure -
if(empty($_POST['email']) || empty($_POST['name'])){ echo 'fields are required'; } ////submit the form something like this?
-
Display Db Records Of The Current Month Only How?
lovephp replied to lovephp's topic in PHP Coding Help
thanks will keep this in mind -
Display Db Records Of The Current Month Only How?
lovephp replied to lovephp's topic in PHP Coding Help
but its already done if i make changes now it will mess up my 5000+ records right? -
Display Db Records Of The Current Month Only How?
lovephp replied to lovephp's topic in PHP Coding Help
no it do not have any datetime its stores time like 1234375645373 thats how it shows in db -
Display Db Records Of The Current Month Only How?
lovephp replied to lovephp's topic in PHP Coding Help
will this be right? $date=date("Y-m-d H:i:s"); $result = mysql_query("SELECT id, aname, cname, hnumber, address, lamount, status, DATE_FORMAT(time,'%M %Y') FROM db_paydayloans ORDER BY id DESC"); my time stores like 12047364546 in timestamp -
friends how do i display the results of the current month only and rest remain on db but on page just the current month posts? here is my current code to display records $result = mysql_query("SELECT id, aname, cname, hnumber, address, lamount, status, time FROM db_paydayloans ORDER BY id DESC"); $rowNo = 1; //Increment Row Number while($res = mysql_fetch_array($result)) { $id = $res['id']; $date = $res['time']; $newdate = date("D, j M, Y", $date); if($res['status'] == "Approved"){ echo "<tr align='center' bgcolor='#CDE861'>"; }else{ echo "<tr align='center' bgcolor='#EDA553'>"; } echo"<td><font color='black'>" .$rowNo++."</font></td>"; echo"<td><font color='black'>" .$res['aname']."</font></td>"; echo"<td><font color='black'>" .strtoupper($res['cname'])."</font></td>"; echo"<td><font color='black'>" .$res['hnumber']."</font></td>"; echo"<td><font color='black'>". $res['address']. "</font></td>"; echo"<td><font color='black'>". $res['lamount']. "</font></td>"; echo"<td><font color='black'>". $newdate. "</font></td>"; if($res['status'] == "Approved"){ echo"<td>Approved</td>"; }else{ echo"<td>Pending</td>"; } echo"<td> <a href ='view.php?id=$id'><center>Click to View </center></a></td>"; if($res['status'] !== "Approved"){ echo"<td><a href ='accepted.php?id=$id'>Approve</a>"; }else{ echo"<td><a href ='cancel.php?id=$id'>Cancel</a>"; } echo"<td> <a href ='del.php?id=$id'><center>Delete</center></a>"; echo "</tr>"; } and this is how i insert data ///////////////////////////////////Insert data function insertP($postData) { $sql = " INSERT INTO db_paydayloans SET aname = '".$_SESSION['aname']."', cname = '".$postData['cname']."', address = '".$postData['address']."', hnumber = '".$postData['hnumber']."', altnumber = '".$postData['altnumber']."', lamount = '".$postData['lamount']."', mrepayments = '".$postData['mrepayments']."', ssn = '".$postData['ssn']."', dln = '".$postData['dln']."', mincome = '".$postData['mincome']."', lpayday = '".$postData['lpayday']."', npayday = '".$postData['npayday']."', abalance = '".$postData['abalance']."', msaving = '".$postData['msaving']."', dob = '".$postData['dob']."', apnumber = '".$postData['apnumber']."', comments = '".mysql_real_escape_string($postData['comments'])."', status = '".$postData['status']."', time = '".time()."' "; executeSql($sql); }
-
Used Real Escape String And In Textarea It Gives \\\
lovephp replied to lovephp's topic in PHP Coding Help
worked by turning off magic_quotes -
Used Real Escape String And In Textarea It Gives \\\
lovephp replied to lovephp's topic in PHP Coding Help
yes it is on so if i off it will it be fixed? -
how to nopt get these \\\ everytime user resubmit the form and if there is any work like don't etc it becomes dont\'t how do i get rid of it?
-
actually i already for a login system and i found this free chat script where u do not need to register u just enter username and password and start chatting, im tryin to send my logged in site users to get into chatroom with the above code in chatenter.php but not sure how to make the url. which will send the data accordingly to what chatenter.php requires
-
how can i send users login details to my chat room through a url than to enter info on form? chatenter.php page looks like this <? include("chat.php"); clearinactiveusers(); // delete inactive users if ($_POST) { if (isset($_POST['username'])) { $result = enterchat($_POST['username'], $_POST['password']); if ($result!="") header("Location: ./?msg=".urlencode($result)); } } else { header("Location: ./"); } ?> and the form.php its kinda like <form method="post" action="chatenter.php"> <table align="center" border="0" cellpadding="0" cellspacing="10"> <tr><td>Username:</td><td><input type="text" name="username" size="15" maxlength="<? echo max_user_len; ?>"></td></tr> <tr><td>Password:</td><td><input type="password" name="password" size="15" maxlength="10"></td></tr> <tr> <td align="center" colspan="2"><input type="submit" value="ENTER CHATROOM"></td> </tr> </table> </form> im actually want to send the user to chat room like chatenter.php?username=name&password=name
-
lillipop :-D
-
$company_email is not gmail its email@somedomain.com but $to is gmail, yahoo hotmail email ids which i input on form. the email goes without any issue to email@somedomain.com but does not goes to yahoo, gmail or hotmail if add from: email address
-
oh just to be on safe side added 2 Conten-type and do you mean this $subject = "(Confirmation) - $company_name"; mail($to, $subject, $message, $headers); i have tried my coding on 2 web hosts on 1 its works like charm but on 1 thi error happens