Jump to content

Jaswinder

Members
  • Posts

    124
  • Joined

  • Last visited

Everything posted by Jaswinder

  1. There is a problem.. No value is displaying on index1.php Here is the code for index1.php <?php if(isset($_POST['submit'])) { extract($_POST); echo "Start time: ".$starttime."<br/>"; echo "End time: ".$endtime=date('H:i:s')."<br/>"; $endstamp=time(); echo "Time-taken : ".$timetaken=($endstamp-$startstamp)/60; } ?>
  2. Thanks jazzman1 , that works. but i can't get the logic.
  3. Oh sorry.. thats a copy/paste error.. Its not working yet.. Any other help
  4. Hi I want to submit the form automatically after sometime,. I have written the code , but its not redirecting/submitting. Don't know why.. Have a look Thanks <!DOCTYPE html> <html> <head> <script type="text/javascript"> setTimeout(function(){document.getElementById("exam").submit()},2000); </script> </head> <body> <?php date_default_timezone_set('Asia/Kolkata'); echo"Start Time: ".$starttime=date('H:i:s')."<br/><br/>"; $startstamp=time(); ?> <form action="inde x1.php" method="post" id="exam" name="exam"> Q1 Your Gender<br/> <input type="radio" value="male" name="gender"> Male <input type="radio" value="female" name="gender"> Female <br /><br /><br /> Q2 You Married<br/> <input type="radio" value="yes" name="marriage"> Yes <input type="radio" value="female" name="marriag e"> No <br /><br /><br /> Q3 2+2<br/> <input type="radio" value="4" name="add"> 4 <input type="radio" value="22" name="add"> 22 <input type="hidden" value="<?php echo $starttime; ?>" name="starttime"><br/> <input type="hidden" value="<?php echo $startstamp; ?>" name="startstamp"><br/> <input type="submit" name="submit"> </form> </body> </ html>
  5. sKunKbad thanks for sublime editor .. atleast its better than dreamweaver.
  6. hello friends I need an extension for dreamweaver. so that i can write quickly in oops / cake php any suggestions ?
  7. hello friends.. i want that after transition the effect should remain there permanently... but with this code.. transition effect get over, after it get completed.. .down { z-index: 100; opacity: 0; -webkit-transition: -webkit-transform 5s ease-in, opacity 1s 5s; transition: transform 5s ease-in, opacity 1s 5s; -webkit-transform: translate3d(0,-100%,0); transform: translate3d(0,-100%,0); } will it possible. ??
  8. hey friends i just made some changes to the cart.php... now the cart is working great... however.. i still looking for @mac_gyver reply.. If u can tell me some easy set of code for the cart.
  9. @mac_gyver .. i have added two products.. and it added properly to the cart.. but on cart page whenever i update the quantity it shows that error... as you asked , here is the output of print_r($_POST) Array ( [quantity-2] => 2 [quantity-1] => 1 [submit] => Update ) the quantity- is there, dont know why it say so... i have provided the files.. will you please download them an try to run on your system.. and also if u think that these codes are complicated , fetch me some easy on .. Thanks for reply
  10. friends.. when i update the cart.. it get updated ,, but still it shows a error Notice: Undefined index: quantity- in C:\xampp\htdocs\cart\cart.php on line 16 i am attaching my files with this topic.. have a look .. and try to update it cart.php connection.php index.php products.php reset.css style.css
  11. hey i got the problem solved,, but its on another file(products.php) .Session is not made properly over there... thank for reply @mac_gyver now i am having problem with cart updation.. i am posting new topic for that,, give a reply to that prob also
  12. Friends i was watching the shopping cart tutorial ,, but stuck in midway.. but i was unable to find my error... here is the code cart.php <?php require('connection.php'); ?> <h1>View Cart</h1> <a href="index.php?page=products" title="Go to products Page">Products page</a> <?php $i="select * from products where id_products IN ("; foreach($_SESSION['cart'] as $id => $value) { $i.= $id. ","; } $i= substr($i,0,-1).") ORDER BY name ASC"; $q=mysql_query($i) or die(mysql_error()); if(empty($q)) { echo " you need to an item first"; } ?> <form method="post" action="index.php?page=cart"> <fieldset> <table> <tr> <th>Name</th> <th>Description</th> <th>Unit price</th> </tr> <?php $i="select * from products where id_products IN ("; foreach($_SESSION['cart'] as $id => $value) { $i.= $id.","; } $i= substr($i,0,-1).") ORDER BY name ASC"; $q=mysql_query($i) or die(mysql_error()); $total_price=0; if(!empty($q)) { while($f=mysql_fetch_array($q)) { $subtotal=$_SESSION['cart'][$f['id_products']]['quantity']*$f['price']; $total_price += $subtotal; ?> <tr> <td><?php echo $f['name']; ?></td> <td><input type="text" name="quantity-<?php echo $f['id_products'];?>" size="5" value="<?php echo $_SESSION['cart'][$f['id_products']]['quantity'];?>" /></td> <td><?php echo "$".$f['price']; ?></td> <td><?php echo "$".$_SESSION['cart'][$f['id_products']]['quantity']*$f['price']; ?></td> </tr> <?php } } ?> error is 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 ') ORDER BY name ASC' at line 1 but the query is exactly same as tutorial.. but there it was working fine..but not with me ???
  13. thanks for replies.... i look into it.. let see what result wil it gives out..
  14. hey friends.. the script is sending email .. but the problem is email is not showing the name and the email id of the sender,, rather it showing the hosting provider name.. as it was sending email to not the sender.. hope i can clear my problem ..here is the code. <form action="feed1.php" method="post"> <table width="100%"> <tr><td>Name</td><td><input type="text" name="name" /></td></tr> <tr><td>E-mail Id</td> <td><input type="text" name="email" /></td></tr> <tr><td>Subject</td><td><input type="text" name="subject"/></td></tr> <tr><td>Message</td><td><textarea rows="10" cols="20" name="message"></textarea></td></tr> <tr><td colspan="2"><input type="submit" value="Send mail" name="sub" /></td></tr> </table> </form> feed1.php <?php error_reporting(-1); if (function_exists('mail')) { extract($_POST); if(!empty($name) && !empty($email) && !empty($subject) && !empty($message)) { if(filter_var($email, FILTER_VALIDATE_EMAIL)) { $to = "sehgal_jas@yahoo.com"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers.= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers.= "From: ".$name."<".$email.">"; // send message if (mail($to, $subject, $message, $headers)) { ?> <script type="text/javascript"> alert('Email Send') window.location='about.php'; </script> <?php } else { ?> <script type="text/javascript"> alert('Sending Failed') window.location='about.php'; </script> <?php } } else { ?> <script type="text/javascript"> alert('Enter valid Email id') window.location='about.php'; </script> <?php }} else ?> <script type="text/javascript"> alert('Enter all the fields') window.location='about.php'; </script> <?php } else { ?> <script type="text/javascript"> alert('Mail function disabled.. Try again after sometime') window.location='about.php'; </script> <?php } ?> Problem The email is showing From: xyz@host261.hostmonster.com (not the email id of the sender and not its name).. any suggestions? you can check this form at http://www.poemquotejoke.com/about.php
  15. thanks for such a knowledgeable reply
  16. hello friends.. i have one issue in searching.. my table structure is this column name type id int jokeby varchar joketitle varchar joke longtext when i run a sql command in my phpmyadmin select * from jokes where jokeby or joketitle like '%anonymous%' - it does not show result but when i change the order of columns like this select * from jokes where joketitle or jokeby like '%anonymous%' - it shows the result.. whats the mess ?? is there any particular order for this ?? i have 1 entry in the table with jokeby anonymous.
  17. @ignace... so it means, the constructor which is called in View class.. is replaced with Controller class construtor..?? if u dont mind... do u have any good link on MVC.. which clearly explain this MVC concept... i read it from the following link. http://r.je/mvc-in-php.html is it good explaination or do u have better one.. ?
  18. nice explanation.....i got it . thanx
  19. Hello friends ,, i have less experience in OOPS till now.. i get confused in the following code.. class Model { public $text; public function __construct() { $this->text = 'Hello world!'; } } class View { private $model; private $controller; public function __construct(Controller $controller, Model $model) { $this->controller = $controller; $this->model = $model; } public function output() { return '<h1>' . $this->model->text .'</h1>'; } } class Controller { private $model; public function __construct(Model $model) { $this->model = $model; } } The problem is In View class constructor arguments ,.. what this means (Controller $controller, Model $model) the code is using the Controller class and Model class ??? is it an alternate to inheritence ?? and also View class is using $text in output() function,, how ??
  20. thanx buddy... i think i sould take a rest for a while... this is how simple it is .. and my mind is not working .. thanx once again
  21. as we know array_rand outputs the keys,, how to get value from it of the random element i tried this:- <?php $n = array("lions", "tigers", "bears", "kittens"); var_dump(array_rand($n)); ?> and also how to get values, if i pass the 2nd parameter i.e. number of random keys we need,, because the array returned by it contain keys as their values
  22. hello friends... i have learned about serialize(), unserialize(), __sleep(), __wakeup(), but i don't get any good example to use all these together.... so that i can practically understand these all properly.... so anyone can fetch me with good example.. also urlencode() and urldecode()..... for what exactly these are used??? any example??
  23. thank you for replies.. i try to give a shot now
  24. hello friends.. i am trying to create calculator using OOPs.. its my first assignment in oops i have created a class in cal.php <?php class calculator { public $one; public $two; public function __construct($one,$two) { $this->one=$one; $this->two=$two; } function sum() { $result=$this->one + $this->two; echo "Sum = ".$result; } function sub() { $result=$this->one - $this->two; echo "Subtraction = ".$result; } function multi() { $result=$this->one * $this->two; echo "Multiplication = ".$result; } function div() { $result=$this->one / $this->two; echo "Division = ".$result; } } ?> i have created a form for user input for calculator in form.php <form action="cal.php" method="post" > Value 1 <input type="text" name="value1" /> Value 2<input type="text" name="value2" /> <input type="submit" value="Submit"> </form> i dont know how to move on now??/ how to fetch values to next page in oops and use them in object??? can we use $_POST ??
×
×
  • 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.