Jump to content

doforumda

Members
  • Posts

    300
  • Joined

  • Last visited

    Never

Everything posted by doforumda

  1. The problem is at this line $bid = $_POST['amount']; I did this now if(isset($_POST['amount'])) { $msg = "amount is set"; } else { $msg = "Amount is not set"; } now it shows Amount is not set but I am sending data to this page but it says it is not set. Help
  2. Hi I am having this error while running my php script using ajax. Everything seems to be fine but I do not know why it is giving this error. <br /> <b>Notice</b>: Undefined index: amount in <b>C:\wamp\www\...\add_bid.php</b> on line <b>3</b><br /> {"error":"yes","fieldErrors":null} Here is my code here is .php code which contains the form <?php session_start(); $auctionid = $_POST['auction_id']; include "design/header.php"; include "DB/db.php"; ?> <div class="contents" id="bid_contents"> <?php $q = "SELECT * FROM bids WHERE productid='$auctionid' ORDER BY bidid DESC LIMIT 0,1"; $query = mysql_query($q) or mysql_error(); //echo $q; $row = mysql_fetch_assoc($query) or mysql_error(); $current_bid = $row['current_bid']; $thumbnail = mysql_query("SELECT * FROM products WHERE productid='$auctionid'"); $row_thumb = mysql_fetch_assoc($thumbnail); $thumb = $row_thumb['thumbnail']; $title = $row_thumb['product_title']; ?> <div id="thumb"> <img src='<?php echo $thumb ?>' border='none' /><br /> <?php echo $title."<br />"; echo "<b>Current Bid:</b> Eur ".$current_bid; ?> <form name="bid_form" id="bid_form"> <input type="text" name="amount" size="5" /> <input type="button" name="place_bid_btn" id="bid_btn" value="Place Bid" /> <div id="message"></div> </form> </div><!-- thumb --> </div> <?php include "design/footer.php" ?> here is .js file for ajax $(function() { $('#bid_btn').click(function() { var url = 'add_bid.php'; var query = $('#bid_form').serialize(); alert(query); $.ajax({ type: 'POST', url: url, query: query, dataType: 'json', success: function(data) { if(data.error == 'no') { $('#message').css('display','none'); } else { $('#message').html(data.fieldErrors).css('display','block'); } } }); }); }); and here is where i get data from previous .php file and the problem seems to be in this page. I guess. Name of this page is add_bid.php <?php session_start(); $bid = $_POST['amount']; $error = 'yes'; $msg = $bid; $JSON_array = array('error' => $error, 'fieldErrors' => $msg); $JSON_response = json_encode($JSON_array); header('Content-type: application/json'); echo $JSON_response; ?> I am adding jquery library and javascript file in my header.php file so it is fine. Please help
  3. Hi I am using very simple code. Here it is <?php session_start(); $user = "guest"; $uid = "1"; echo $_SESSION['user']."<br />"; echo $_SESSION['uid']; ?> it displays this error Notice: Undefined index: user in C:\wamp\www\DealDash\index.php on line 5 Notice: Undefined index: uid in C:\wamp\www\DealDash\index.php on line 6 how can I solve this problem? Help please
  4. it looks like yyyy-mm-dd format
  5. hi i get date of birth of db. now i want to split day month and year from that date and put them in different variables. e.g, $dob = $row['dob']; how would i do this?
  6. it is working but what if i want to select 3 words rather than alphabets. how can i do that?
  7. i want to select some alphabets from mysql db column. lets say i have a table with column name article. now i want to select about three words from this column and display it as "three words here..." how can this be achieve?
  8. when i echo this query it displays this UPDATE messages SET read='read' WHERE mid='2' which is correct i guess
  9. hi i am using an update query but it is not working. it gives this error 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 'read='read' WHERE mid='2'' at line 1 here is my query $mid = $_GET['mid']; $msg = mysql_query("SELECT * FROM messages WHERE mid='$mid'") or die(mysql_error()); if(mysql_num_rows($msg) > 0) { $row_read = mysql_fetch_assoc($msg); $read_db = $row_read['read']; if($read_db == 'unread') { //echo "unread"; $read = mysql_query("UPDATE messages SET read='read' WHERE mid='$mid'") or die(mysql_error()); } }
  10. hi i need help in uploading one image to two different directories. How can i do this. My current code is able to upload image to one directory but it does not upload it to second directory. Here is my code <?php session_start(); include("../db/db.php"); include("../functions/getExtension.php"); $image_name = $_FILES['my_photo']['name']; $image_type = $_FILES['my_photo']['type']; $image_size = $_FILES['my_photo']['size']; $image_temp_name = $_FILES['my_photo']['tmp_name']; $error = $_FILES['my_photo']['error']; $album_name = $_POST['album_name']; $ext = getExtension($image_name); $ext = strtolower($ext); if($error == 0) { $location = "photos/user$_SESSION[userid]/".$album_name."/".$image_name; $location_full_image = "photos/user$_SESSION[userid]/".$album_name."_full/".$image_name; if($image_size < 3145728) { //3145728 = 3MB if($ext == "png" || $ext == "jpeg" || $ext == "jpg" || $ext == "gif") { if(!file_exists($location)) { move_uploaded_file($image_temp_name, $location); move_uploaded_file($image_temp_name, $location_full_image); $add_image = mysql_query("INSERT INTO photos VALUES('', '$_SESSION[userid]', '$_SESSION[username]', '$_SESSION[email]', '$album_name', '$location', 'no')") or die(mysql_error()); header("Location: photos.php"); } else echo "Image with the name you specified already exist at location $location. Please upload image with changed name."; } else echo "Only png, jpeg, jpg and gif file formats are allowed to upload."; } else echo "Image size is too big. Your Image must be 3 or less than 3MB."; } else echo "There is an error uploading file. Error Code: $error"; ?>
  11. this is what i am trying to do. $y = $total_eid + 1; for($x = $y; $x <= $total; $x++) { $c = $cert[$x]; $i = $i_name[$x]; $ci = $c[$x]; $fm = $from_month[$x]; $fy = $from_year[$x]; $tm = $to_month[$x]; $ty = $to_year[$x]; }
  12. it displays this kind of error Notice: Undefined offset: 3 in C:\wamp\www\pkbook\p_pr\edu.php on line 31 Notice: Undefined offset: 3 in C:\wamp\www\pkbook\p_pr\edu.php on line 32 Notice: Undefined offset: 3 in C:\wamp\www\pkbook\p_pr\edu.php on line 33 Notice: Undefined offset: 3 in C:\wamp\www\pkbook\p_pr\edu.php on line 34 Notice: Undefined offset: 3 in C:\wamp\www\pkbook\p_pr\edu.php on line 35 Notice: Undefined offset: 3 in C:\wamp\www\pkbook\p_pr\edu.php on line 36 Notice: Undefined offset: 3 in C:\wamp\www\pkbook\p_pr\edu.php on line 37 3 is the value of $x yes $total is defined.
  13. Hi, Can we do something like this in for loop $y = $total_eid + 1; for($x = $y; $x <= $total; $x++) { some code to process } i am trying this but it is not working for me how can i achieve such kind of task
  14. hi I need help about Is there any way to shorten url or to make url appear different in url area in web browser than the real url? I mean that lets say this is url "http://www.phpfreaks.com/forums/index.php?action=post;board=1.0" and i want this to appear something like this in web browser url area "http://www.phpfreaks.com/forums/XCDSDFVG" or appear something else but it does not show the real web site. Is there any way to do this? if Yes can you give me link to that site where i can find about this. Thanks in advance
  15. i mean when you type on phpfreaks to post . when you want to provide a source code for the problem then you write that code inside " " these code tags
  16. hi how can i create a textarea that gets code inside "code" tags and then display it different than other text?
  17. i want to do something like this <?php $connect = mysql_connect("localhost","user","pass"); $db = mysql_select_db("db"); $get_data = mysql_query("SELECT * FROM posts"); while($row = mysql_fetch_assoc($get_data)) { $postid = $row['postid']; $post = $row['post']; ?> <div> <?php echo $postid."<br>".$post; ?> <style> .reply_container<?php echo $postid; ?> { display: none; } </style> <input type="hidden" name="click" id="click" value="<?php echo $_SESSION['postid']; ?>" /> <a class="click_here" href="#">Click</a> </div> <div class="reply_container<?php echo $postid; ?>"> <form action="" method="post"> <textarea name="reply" id="reply" rows="3" cols="40"></textarea> <input type="button" name="replybtn" id="replybtn" value="reply" /> </form> </div> <?php } ?> <div class="display"></div> <script type="text/javascript" src="lib/jquery-1.4.min(Production).js"></script> <script> $(document).ready(function() { $('.click_here').click(function() { var clickval = $('#click').val(); alert(clickval); $('.reply_container' + clickval).css('display','block'); }); }); </script>
  18. the purpose of doing this is, i ll have reply link instead of click here and when user clicks on reply then a hidden textarea will appear only below that particular post for which user clicks reply thats why i am trying to do this
  19. is there any other way to do this, without using form and session var?
  20. yes i know it works that way but i need it this way. how can i do this way
  21. hi i am trying to post hidden type data. the problem is when i press click link then it should display that postid for which user clicks click link. but it only displays the first post's postid here is my code <?php $connect = mysql_connect("localhost","user","pass"); $db = mysql_select_db("db"); $get_data = mysql_query("SELECT * FROM posts"); while($row = mysql_fetch_assoc($get_data)) { $postid = $row['postid']; $post = $row['post']; ?> <div> <?php echo $postid."<br>".$post; ?> <input type="hidden" name="click" id="click" value="<?php echo $postid ?>" /> <a class="click_here" href="#">Click</a> </div> <?php } ?> <script type="text/javascript" src="lib/jquery-1.4.min(Production).js"></script> <script> $(document).ready(function() { $('.click_here').click(function() { var clickval = $('#click').val(); alert(clickval); }); }); </script>
  22. hi i create a contact form. When user send me a message then at From column in my inbox i see something like this "example@eg.justhost.com". It should be "My Web". How can i make it to My Web instead of "example@eg.justhost.com" here is mu code <?php $name = strip_tags(addslashes($_POST['name'])); $email = strip_tags(addslashes($_POST['email'])); $message = strip_tags(addslashes($_POST['msg'])); if($name) { if($email) { if(ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)) { if($message) { $to = "web@example.com"; $from = "My Web"; $msg = $message; $subject = "Message from zafarsaleem.info"; $mail = mail($to,$subject,$msg,$from); //$mail = true; if($mail) { echo "Your message has been sent. Thank you for contacting."; } else echo "Sending message failed. Please try again later."; } else echo "Enter your message."; } else echo "Enter valid email address."; } else echo "Your email is required."; } else echo "Your name is required."; ?>
  23. where should i add error_reporting and how?
×
×
  • 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.