Jump to content

vinpkl

Members
  • Posts

    448
  • Joined

  • Last visited

Everything posted by vinpkl

  1. hi this is the code that is inserted before the <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" starts $status="Hide"; if(isset($_REQUEST['status'])) { $pid=$_REQUEST['status']; echo $pid; $qry="select * from product_table where product_id=$pid"; $result=mysql_query($qry); $row=mysql_fetch_array($result); if($row['status']=='Y') { $updtqry="update product_table set status='N' where product_id=$pid"; mysql_query($updtqry,$conn) or die("Not updated"); } else { $updtqry="update product_table set status='Y' where product_id=$pid"; mysql_query($updtqry,$conn) or die("Not updated"); } if($row['status']=='Y') { $status = "Hide"; } else { $status = "Show"; } } and the other code is in my <table> tag <table width="901" cellpadding="6" cellspacing="0" class="bordr"> <tr style="background-color:#CCCCCC; height:25px"> <td>Product ID </td> <td>Product Name </td> <td>Description </td> <td>Cutout Price</td> <td>Price</td> <td>Product Image</td> <td>Shipping cost</td> <td>Shipping detail</td> <td>warranty</td> <td>Show/hide</td> <td>Action</td> </tr> <?php if(isset($_REQUEST['dealer_id'])) { $dealer_id=$_REQUEST['dealer_id']; $qry="select * from product_table where dealer_id=$dealer_id"; //echo $qry; $result = mysql_query($qry); if(mysql_num_rows($result)>0) { while($row=mysql_fetch_array($result)) { echo "<tr>"; echo "<td valign=top>". $row['product_id'] . "</td>"; echo "<td valign=top>". $row['product_name'] . "</td>"; echo "<td valign=top>". $row['description'] . "</td>"; echo "<td valign=top>". $row['cutout_price'] . "</td>"; echo "<td valign=top>". $row['price'] . "</td>"; echo "<td valign=top>". "<img border=1 height=115 width=92 src='uploads/" . $row['image'] . "'/>" . "</td>"; echo "<td valign=top>". $row['shipping_cost'] . "</td>"; echo "<td valign=top>". $row['shipping_detail'] . "</td>"; echo "<td valign=top>". $row['warranty'] . "</td>"; echo '<form name="status_update" action="manage_products.php" method="post">'; echo '<td valign="top"><input type="submit" value="'.$status.'" />'; echo '<input type="hidden" name="status" value="'.$row['product_id'].'" />'; echo '</td>'; echo '</form>'; echo "<td valign=top>"."<a href='modify_products.php?id=" . $row['product_id'] . "'/> Modify </a>" . "</td>"; echo "</tr>"; } } }
  2. i think that you will find that the problem is that when the page loads it does not get a product from the database and therefore when you click the hide button the database is trying to update the row with product_id="" and as this doesn't exist the value of status will never equal 'Y' and the button will always say "hide" HI To make myself more clear. I have a dropdown of dealer list on my page from where i select the dealer and This is all i receive on selecting the dealer and not clicking the hide/show button. product image, product id, description, price etc everything is coming from database and showed on the page. if(isset($_REQUEST['dealer_id'])) { $dealer_id=$_REQUEST['dealer_id']; $qry="select * from product_table where dealer_id=$dealer_id"; //echo $qry; $result = mysql_query($qry); if(mysql_num_rows($result)>0) { while($row=mysql_fetch_array($result)) { echo "<tr>"; echo "<td valign=top>". $row['product_id'] . "</td>"; echo "<td valign=top>". $row['product_name'] . "</td>"; echo "<td valign=top>". $row['description'] . "</td>"; echo "<td valign=top>". $row['cutout_price'] . "</td>"; echo "<td valign=top>". $row['price'] . "</td>"; echo "<td valign=top>". "<img border=1 height=115 width=92 src='uploads/" . $row['image'] . "'/>" . "</td>"; echo "<td valign=top>". $row['shipping_cost'] . "</td>"; echo "<td valign=top>". $row['shipping_detail'] . "</td>"; echo "<td valign=top>". $row['warranty'] . "</td>"; echo '<form name="status_update" action="manage_products.php" method="post">'; echo '<td valign="top"><input type="submit" value="'.$status.'" />'; echo '<input type="hidden" name="status" value="'.$row['product_id'].'" />'; echo '</td>'; echo '</form>'; echo "<td valign=top>"."<a href='modify_products.php?id=" . $row['product_id'] . "'/> Modify </a>" . "</td>"; echo "</tr>"; } } }
  3. hi which this change if i have to hide the product then i will have to press the hide button 2 times. It will change the Enum status to "N" and hide on second time. But still it doesnt change button status value to "show". vineet
  4. does this page receive $_REQUEST['status'] when it first loads? or only once the user clicks the hide/show button? Hi i tell you everything in detail what is happening. In the database i have status field with enum datatype value "Y" and "N" and default set to "Y". So when the page in which "this submit button" is inserted will display button value as "Hide". When i click the "Hide button" then on top of the page it echos "7" that is the product_id. but it doesnt change to "show". vineet
  5. hi this is what i have added that u said $status="Hide"; if(isset($_REQUEST['status'])) { $pid=$_REQUEST['status']; echo $pid; $qry="select * from product_table where product_id=$pid"; $result=mysql_query($qry); $row=mysql_fetch_array($result); if($row['status']=='Y') { $updtqry="update product_table set status='N' where product_id=$pid"; mysql_query($updtqry,$conn) or die("Not updated"); } else { $updtqry="update product_table set status='Y' where product_id=$pid"; mysql_query($updtqry,$conn) or die("Not updated"); } if($row['status']=='Y') { $status = "Hide"; } else { $status = "Show"; } } echo '<form name="status_update" action="manage_products.php" method="post">'; echo '<td valign="top"><input type="submit" value="'.$status.'" />'; echo '<input type="hidden" name="status" value="'.$row['product_id'].'" />'; echo '</td>'; echo '</form>';
  6. hi Now its showing everytime "Hide". Its not toggling with "Hide" and "Show". Its functioning properly means on first click its hiding the product and on second click its showing the product. But its not changing its status from "hide" to "show". everytime its showing on it "Hide". vineet
  7. hi i tried your code but still it doesnt show the value "show" or "hide" on it. it shows blank button. neither any error is coming. vineet
  8. hi all i have a input type button name="status" which on click change the enum status of the field in database to "Y" or "N". If the status is "Y" the product is showed to public but if the status is "N" then the product gets hide for public. But the problem i m facing is that i m not able to write the value "hide" or "show" on input type button because the value i have taken is the product_id. If i change the value to "show" or hide then it doesnt work. The code i m using is if(isset($_REQUEST['status'])) { $pid=$_REQUEST['status']; echo $pid; $qry="select * from product_table where product_id=$pid"; $result=mysql_query($qry); $row=mysql_fetch_array($result); if($row['status']=='Y') { $updtqry="update product_table set status='N' where product_id=$pid"; mysql_query($updtqry,$conn) or die("Not updated"); } else { $updtqry="update product_table set status='Y' where product_id=$pid"; mysql_query($updtqry,$conn) or die("Not updated"); } } echo "<form name='status_update' action='manage_products.php' method='post'>"; echo "<td valign=top>". "<input type ='submit' name='status'". "value=" . $row['product_id'];?> <?php if($row['status']=='Y') echo 'checked';?> <?php echo "</td>"; echo "</form>"; I want to know how can i do exactly the same with two image as buttons. one image button name=hide and other image button name=show. When hide image button is click then the product will hide and when the show image button is click the product will show. I tried this but this doesnt worked. please help echo "<td valign=top>"; if ($row['status']==Y) { echo "<a href='manage_products.php?=" . $row['product_id'] . "'>" . "<img src='../images/hide_icon.gif' name='status' id='status'>" . "</a>"; } else { echo "<a href='manage_products.php?status" . $row['product_id'] . "&" .$row['status']=Y. "'>" . "<img src='../images/show_icon.gif' name='status' id=status'>" . "</a>"; } echo "</td>";
  9. hi all i have a table name product_table in my database. i want to add a field name "status" in "product_table" after "warranty" field with ENUM values ("Y,"N"). I m getting the following error when writing in qry in sql field or adding the field by choosing values and datatype manually. SQL query: ALTER TABLE product_table ADD COLUMN status TYPE ENUM( "Y", "N" ) AFTER warranty MySQL said: #1064 - 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 'TYPE ENUM ("Y", "N") AFTER warranty' at line 1 vineet
  10. Hi sas thanks. working perfect. vineet
  11. hi sasa thanks for the reply. its works great. i would like to ask that if i am right then $count is for product. And this wil display 4 products in each row till the end of number of products in database. can we apply condition that only 3 rows should be displayed mean only 12 products on page (3rows x 4products). Means 3 rows containing of 4 products each. i dont want to show all the products. vineet
  12. hi rajuvs thanks a lot. it worked great. it worked like i wanted. one thing more i would like to ask that i 20 products in the database from where these products are coming. But i want to display only 4 in my page not all 20. what condition will apply vineet hi ranjuvs This code displays four products in a row as i needed. if i need that after these four products, the next four products should showup in 2nd row and then next four products in 3rd row. what do we need to change in this code vineet
  13. hi rajuvs thanks a lot. everything works perfect. vineet
  14. hi rajuvs thanks a lot. it worked great. it worked like i wanted. one thing more i would like to ask that i 20 products in the database from where these products are coming. But i want to display only 4 in my page not all 20. what condition will apply vineet
  15. hi rajuvs thanks for reply. actually what u did is splitted my content into four rows but different columns. but i need these four rows content to come horizontally not vertically. means like 1|2|3|4. let me make my question more clear again : 1) i need four columns in a table means 4 <td>. 2) i have a table which contains 5 rows in which first row contains product image, second row contains product name, third row contains product description, forth row contains product cutout price and fifth row contains product price. 3) now i need all this content of this table with 5 rows to be inserted in my 4 columns with separate products. means the 2no. table that contains content will be inserted in all 4 columns with different image, description, price etc. i think i may be clear with my question now. vineet
  16. hi all i m using this script to fetch and display products in my page. the "for loop" creates four columns. and the other part fetches and display the products. but my problem is that i m not able to insert the products in 4 columns created by "for loop". when i change ($i=result1) then the script doesnt work. <?php for($i=1;$i<=1;$i++) { //echo "<tr>"; echo "<td width=148>" .$i."</td>"; echo "<td width=148>" .$i."</td>"; echo "<td width=148>" .$i."</td>"; echo "<td width=148>" .$i."</td>"; //echo "</tr>"; $qry1="select * from product_table"; $result1 = mysql_query($qry1); if(mysql_num_rows($result1)>0) { while($row1=mysql_fetch_array($result1)) { echo "<table border=1 bgcolor=#ffddee>"; echo "<tr>"; echo "<td width=125>" . "<img width=116 height=117 src='admin/uploads/" . $row1['image'] . "'/>" . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td valign=top width=125>". $row1['product_name'] . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td valign=top>". $row1['description'] . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td valign=top class=cut>". $row1['cutout_price'] . "</td>"; echo "</tr>"; echo "<tr>"; echo "<td valign=top>". $row1['price'] . "</td>"; echo "</tr>"; echo "</table>"; } } }
  17. hi where should i insert your code in my code. i m not calling image1 and image2 manually. these are called by loop in php code. where can i write <div class="left"> and <div class="right">. in my code : echo "<td valign=top>". "<img height=200 width=253 src='admin/uploads/" . $row['offer_image'] . "'/>" . "</td>"; is calling both the images from same table column name "offer_image" from the mysql database. please elaborate i m new to it vineet
  18. hi all i want to display two offer ads images in my php page. i am able to fetch data from mysql in my page. But the trouble is the script below displays the data in rows like one ad image above and second ad image below. i want to display one ad in left and second ad in its right. how is it possible. vineet <?php $qry="select * from special_offers order by offer_id"; $result = mysql_query($qry); if(mysql_num_rows($result)>0) { while($row=mysql_fetch_array($result)) { echo "<tr>"; echo "<td valign=top>". "<img height=200 width=253 src='admin/uploads/" . $row['offer_image'] . "'/>" . "</td>"; echo "<td>". "<img src='images/spacer.gif' width=15 height=2 />" . "</td>"; echo "</tr>"; } } ?>
  19. hi scott i tried -------------------------------------------- $headers = "From: $from"; $message = "confirmation Email this info has been sent to {$to}\n{$message}"; mail($Visitor_Email1,"confirmation Email",$to,$message,$headers); ------------------------------------------------- $message = "confirmation Email this info has been sent to {$to}\n{$message}"; mail($Visitor_Email1,"confirmation Email",$to,$message,$headers); ------------------------------------------------------------ the from body contains the same "nobody" vineet
  20. hi scott i used this in two ways -------------------------------- $message = "confirmation Email this info has been sent to {$to}\n{$message}"; $headers = "From: $from"; mail($Visitor_Email1,"confirmation Email",$to,$message); ------------------------------------ $message = "confirmation Email this info has been sent to {$to}\n{$message}"; mail($Visitor_Email1,"confirmation Email",$to,$message); $headers = "From: $from"; mail($Visitor_Email1,"confirmation Email",$to,$message); ----------------------- in first way i receive mail with the same from body contains "nobody" and by using second way i dont receive any email. vineet
  21. hi scott your this code also worked fine. but there is one issue. and that is the "From" body contains "Nobody". i mean where we read that this email is from this person. there its written "Nobody". I want to replace "Nobody" with clients "email address". When the visitor receives the confirmation email in his email account he should read that this email is from that website where he filled the form. vineet
  22. hi scott thanks. you were right. i got it working with your code. one thing more i would like to ask that how can the visitor to the site who fills email address in the form receive a confirmation email in his email address that we have received his information on submitting form. i mean when the visitor submits the form he should receive an confirmation email in his email adress. vineet
  23. hi everyone just joined, i using php script to send email. i m receiving the labels only not the content filled in the form. means i m receiving the heading "name = " but not receiving "my name written" when i fill the name in the input field for the name in the form. just this i m receiving Full Name : Email ID : Mobile : enquiry : vineet this is my php script used to send mail <?php $Visitor_Name1; //Name Of Visitor. $Visitor_Email1; //Visitors Email address. $Visitor_Mobile1; //mobile Of Visitor. $Visitor_Enquiry1; //information //Assignment of form values in variables. $Visitor_Name1=$name1; $Visitor_Email1=$email1; $Visitor_Mobile1=$mobile1; $Visitor_Enquiry1=$enquiry1; $message .= "Full Name : $Visitor_Name1\n"; $message .= "Email ID : $email1\n"; $message .= "Mobile : $mobile1\n"; $message .= "enquiry : $Visitor_Enquiry1"; $from ="info@user.com"; $to = "me@yahoo.com"; $subject = "GADGETS ENQUIRY FORM"; $headers = "From: $from"; mail($to,$subject,$message,$headers); $URL="thanks.html"; header ("Location: $URL"); ?> ------------------------- this is my html form <form action="enquiry.php" class="content" name="form1" method="post"><table width="350" border="0" cellspacing="0" cellpadding="8"> <tr> <td colspan="2">You can also fill our enquiry form :</td> </tr> <tr> <td width="147">Name : </td> <td width="353"><input name="name1" type="text" id="name1" tyle="width:250px" /></td> </tr> <tr> <td>Email : </td> <td><input name="email1" type="text" id="email1" style="width:250px" /></td> </tr> <tr> <td>Mobile : </td> <td><input name="mobile" type="text" id="mobile" style="width:250px" /></td> </tr> <tr> <td valign="top">Enquiry : </td> <td><textarea name="enquiry" rows="4" id="enquiry" tyle="width:250px"></textarea></td> </tr> <tr> <td> </td> <td><input type="submit" name="Submit" value="Submit" class="submt" /></td> </tr> </table></form>
×
×
  • 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.