Jump to content

vinpkl

Members
  • Posts

    448
  • Joined

  • Last visited

Everything posted by vinpkl

  1. hi all I m using tinymce for adding content to my website. also i m using $detail = mysql_real_escape_string('$detail'); When ever i select text and change its colour, tinymce add <span> tag to it with a slash in style attribute. This is what is getting added to my database <p><span style=\"color: #3366ff;\">Feel free to try</span> out the different features that are provided,</p> When i echo it on my detail page echo $detail; then the style color doesnt get applied on the text. what should i do to echo the text in colored format. vineet
  2. hi The below code works fine. But i would like to know if this below code be written or converted to foreach loop intead of forloop $ppid = array(); $ppid = $_REQUEST['updt_pid']; $quantity = array(); $quantity = $_REQUEST['quantity']; for($i=0;$i<count($quantity);$i++) { $cart_update_query = "UPDATE cart_table SET quantity=$quantity[$i] where product_id=$ppid[$i]"; $cart_update_result=mysql_query($cart_update_query)or die(mysql_error()); } vineet
  3. hi how can i disable magic quotes. i m on shared hosting vineet
  4. hi So I will have to convert all my present code <? $name = mysql_real_escape_string($_POST['name']); $email = mysql_real_escape_string($_POST['email']); $detail = mysql_real_escape_string($_POST['detail']); ?> to like the below code on every page <? if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { $name = stripslashes($_POST['name']); $email = stripslashes($_POST['email']); $detail = stripslashes($_POST['detail']); } $name = mysql_real_escape_string($_POST['name']); $email = mysql_real_escape_string($_POST['email']); $detail = mysql_real_escape_string($_POST['detail']); ?> vineet
  5. hi all We use mysql_real_escape_string when magic_quotes_gpc is On or when magic_quotes_gpc is off vineet
  6. hi This below is the where clause of my query where s.categoryid = ".mysql_real_escape_string(p.categoryid). " when i echo the query, the output is where s.categoryid = pcategoryid The dot between p and categoryid is removed with mysql_real_escape_string vineet
  7. thanks kicken now they dont blink. But they should disappear when second time user enters correct data and click submit button. can you help me with that ? vineet
  8. hi all why does my validation error messages blink of click they dont stay static. whats the solution <!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" xml:lang="en" lang="en"> <head> <title></title> </head> <script type="text/javascript"> function doValidate() { if(document.registerform.textbox1.value= " ") { document.getElementById("hiddenDiv").innerHTML = "enter your email id its required"; } if(document.registerform.textbox2.value= " ") { document.getElementById("hiddenDiv2").innerHTML = "enter your password id its required"; } } </script> <body> <form onsubmit="return doValidate();" method="post" name="registerform"> <input name="textbox1" id="textbox1" /><div id="hiddenDiv"></div> <input name="textbox1" id="textbox2" /><div id="hiddenDiv2"></div> <input type="submit" name="" value="Submit"/> </form> </body> </html> vineet
  9. thanks chris i will modify it accordingly vineet
  10. hi all if both login and password fields are empty then after click of ok button of alert box, the focus should go to login input field, but it goes of password input field <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> <script type="text/javascript"> function isFormValid() { var retVal = true; var errorMsg = ""; if(document.loginform.username.value=='') { errorMsg = "Must Enter Login-ID\n"; document.loginform.username.focus(); retVal = false; } if(document.loginform.userpassword.value=='') { errorMsg = errorMsg + "Password is required\n"; document.loginform.userpassword.focus(); retVal = false; } if (!retVal) { alert(errorMsg); } return retVal; } </script> </head> <body> <form id="loginform" name="loginform" method="post" onsubmit="return isFormValid();" action=""> <p><label>Enter User Id</label><input type="text" id="username" name="username" class="logininput" /></p> <p><label>Enter Password</label><input type="password" name="userpassword" id="userpassword" class="logininput" /></p> <input type="submit" value="submit" class="login_bt" name="login_submit" /></p> </form> </body> </html>
  11. hi all i want to add multiple products using selected checkboxes to cart i m passing checkbox values from product page to cart page <input type="checkbox" value="1" name="related[]" /> <input type="checkbox" value="2" name="related[]" /> <input type="checkbox" value="3" name="related[]" /> <input type="submit" value="addtocart"> i tried below code in "cart.php" but this code output "ids" as array <? $related_all = array(); $related_all = $_REQUEST['related']; foreach($_REQUEST['related'] as $product_id) { if(isset($_REQUEST['related'])) { $id=$_REQUEST['related']; echo $id; /* ouput as ArrayArrayArray */ $qry = "select * from product_table where product_id = $id"; echo $qry; /* output = where product_id = Array */ } } ?> vineet
  12. hi jazz <ul> ouput is empty <ul> no li items are displayed </ul> vineet
  13. hi jazz Your code output comes as <ul><li>item 1<li></ul> <ul><li>item 1<li></ul> <ul><li>item 1<li></ul> <ul><li>item 1<li></ul> <ul><li>item 1<li></ul> <ul><li>item 1<li></ul> <ul><li>item 1<li></ul> <ul><li>item 1<li></ul> <ul><li>item 1<li></ul> I want to have it in single <ul></ul> like this below <ul> <li>item</il> <li>item</il> <li>item</il> <li>item</il> <li>item</il> <li>item</il> <li>item</il> <li>item</il> <li>item</il> </ul> vineet
  14. hi all i m creating dropdown menu and i want to split the menu items in the multiple columns I tried this <ul style="padding-bottom:20px;"> <?php $leftqry="select * from itemstable where item_catg='men'"; $leftresult=mysql_query($leftqry); for($i = 0; $i < 10; $i++){ //$leftrow=mysql_fetch_array($leftresult); while($leftrow = mysql_fetch_array($leftresult)) { if (($i % 2) == 0) echo("</ul><ul>"); echo "<li>" . "<a class='leftnav' href='http://localhost/products.php?category_id=10&dealer_id=22'>ยป " .$leftrow['item_name']. "</a></li>"; } } ?> </ul> this output the list as <ul><li>item 1</li></ul> <ul><li>item 2</li></ul> <ul><li>item 3</li></ul> and so on But i want it to output the list like this below <ul> <li> <li> <li> <li> <li> <li> <li> <li> <li> </ul> vineet
  15. ok, i can create new table and add the new accessories accordingly. but what should i do for the accessories already added to the database. they are many. vineet
  16. hi all I have "model" field in accessory category of product table which have values like "E71,E72,E73,E74......" On the "mobile product" page i want to match the model of accessories with model of mobile and display them. /* query to select all models from accessories category from product table */ $qry_model="select * from product_table where category_id=4"; $qry_model_result=mysql_query($qry_model); while($qry_model_row=mysql_fetch_array($qry_model_result)) { $desc_model_all = $qry_model_row['model']; $desc_model_all = explode(',', $desc_model_all); foreach ($desc_model_all as $value) { echo $value; /* this outputs as E73E72 */ } } $mobile_model = $row['model']; if($value == $mobile_model) /* problem starts here */ { $qryc="select * from product_table where model = '$value' and category_id=4"; $resultc = mysql_query($qryc); if(mysql_num_rows($resultc)>0) { // product detail is displayed here }
  17. i got php version 5 and working in xampp
  18. hi kicken i get this error by using your code Warning: DOMDocument::saveHTML() expects exactly 0 parameters, 1 given in F:\xampp\htdocs\style_strip1.php on line 30 this is my full code $doc = new DOMDocument(); $doc->loadHTML($html); $search = new DOMXPath($doc); $results = $search->evaluate('//*[@style]'); foreach ($results as $result) $result->removeAttribute('style'); $newhtml = $doc->saveHTML(); /*echo $newhtml;*/ echo $doc->saveHTML($doc->documentElement);
  19. hi batwimp Is there any solution by which i can use this same DOM code and html tags are loaded once vineet
  20. config.php doesnt echo anything. its just for connecting to database vineet
  21. Hi all i m using DOM code to strip the inline styles. The problem is that when i "view source" my code in browser then i see 2 <html>tags and 2<doctype> tags starting <?php require_once("config.php"); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> here is the second doctyle starts <? $html = '<table> <tbody> <tr style="PADDING-BOTTOM: 0px; BORDER-RIGHT-WIDTH: 0px;"> <td style="BACKGROUND-IMAGE: none; BORDER-BOTTOM: rgb(240,240,240) 1px solid;">2G Network</td> <td style="BACKGROUND-COLOR: rgb(250,250,250); MARGIN: 0px;">GSM 850 / 900 / 1800 / 1900</td> </tr> </tbody> </table>'; $doc = new DOMDocument(); $doc->loadHTML($html); $search = new DOMXPath($doc); $results = $search->evaluate('//*[@style]'); foreach ($results as $result) $result->removeAttribute('style'); $newhtml = $doc->saveHTML(); echo $newhtml; ?> </body> </html> This is the view source from browser <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> here is the second doctyle starts <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <html><body><table><tbody><tr> <td>2G Network</td> <td>GSM 850 / 900 / 1800 / 1900</td> </tr></tbody></table></body></html> </body> </html> so can anyone tell me how to use and echo result from DOM but with validated html Vineet
  22. hi i m adding the last field to my query but getting unexpected t_string error $order_detail="insert into detail_table(unique_id,order_id, customer_name, customer_login_id, order_date, product_name, quantity, shipping, price,total_cost,compatibility) values('$unique_id',$order_id,'$username','$log_id','$shop_date','".$row['product_name'] . "' , " . $row['quantity'] . "," . $row['shipping_cost'] . ",". $row['price'] .",". $row['total_cost']. ",". '". $row['compatibility'] . "'. ")"; mysql_query($order_detail); help me remove it vineet
  23. hi all I have 3 checkboxes whose values are getting stored in the database with a comma separator. <input name="color[]" type="checkbox" value="red" id="red" />red <input name="color[]" type="checkbox" value="blue" id="blue" />blue <input name="color[]" type="checkbox" value="green" id="green" />green values getting stored with comma separator red, blue, green now i want to show the checkboxes as "checked" to show the customer as which colors they chose lasttime when they submitted the form. How can i make it possible ? If it is possible without the comma separator then i can remove the comma. vineet
  24. hi all i m having two separate restricted access folders based on separate login forms and sessions. i m using same technique for both folder files. everything works fine for first folder but having trouble with second folder files. i have a form page in second folder which is accessible only after the user gets logs in. when a user logs in second folder then a session repair_access is set to true for second folder. $_SESSION['REPAIR_ACCESS'] = true; after loggin the user enter information in the form, when he click submit button the information is getting stored in database correctly but he is redirected to index.php which is login page. i m not able understand that if the user reaches the form page that means the SESSION has been set to true but then why is he redirected back to loginpage when he clicks submit button. this is my config file for second folder $conn3=mysql_connect("localhost","root","") or die(mysql_error()); mysql_select_db('repair_data', $conn3); session_start(); this code is on top of my form in second folder <?php require_once("config.php"); if(!isset($_SESSION['REPAIR_ACCESS'])) header("Location:index.php"); $msg=""; ?> Are the sessions conflicting with anything ? vineet
  25. hi all i have different categories like mobiles, cameras, gps etc. then i have product_table in which products are added under those categories. now i want to show a special coupon button on invoices which include mobile purchases by customers. so if a invoice contains "mobile phone" then only that button should appear in front of invoice number. i have 1) product_name in order_detail_table. 2) category_name "mobile phone" in product_table. so its a huge database and i cannot change anything in it. where i m stuck is how to check that invoice contains mobile phone. $or_detail_qry="select * from order_detail_table where order_id = $ord_id"; $or_detail_result=mysql_query($or_detail_qry); while($or_detail_row=mysql_fetch_array($or_detail_result)) { $product_name=$or_detail_row['product_name']; } $prod_qry="select * from product_table where category_name='Mobile Phones'"; $prod_result=mysql_query($prod_qry); while($prod_row=mysql_fetch_array($prod_result)) { $prod_name=$prod_row['product_name']; } if(($product_name == $prod_name)) { echo "<td>". "<img src='images/special_coupon.gif' />" . "</td>"; } the whole above code is inside a while loop which displays all the invoices result rows. vineet
×
×
  • Create New...

Important Information

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