PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #31  
Old August 14th, 2008, 12:21 PM
jadi's Avatar
jadi jadi is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2008
Location: New Jersey, USA
Posts: 190 jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 7 h 24 m 28 sec
Reputation Power: 4
I even tried this but now it is not displaying even the id??????????????????

PHP Code:
<?php
$connection 
mysql_connect("localhost""root""") or die("Cannot connect to MySQL server: " mysql_error());
$db_selected mysql_select_db('tmetrix'$connection);

$id=$_GET['id'];
echo 
"$id";


$sql="SELECT * FROM comments WHERE c_id='$id'";
$result=mysql_query($sql);

$rows=mysql_fetch_array($result);

echo 
"<tr><td style='color: #666666;text-align:left;font-size:small;font-family:Tahoma'>" .$row['name'] . "</td> "
echo 
"<td style='color: #666666;text-align:left;font-size:small;font-family:Tahoma'>" .$row['CELLID'] . "</td> "
echo 
"<td style='color: #666666;text-align:left;font-size:small;font-family:Tahoma'>" .$row['problem'] . "</td> "
echo 
"<td style='color: #666666;text-align:left;font-size:small;font-family:Tahoma'>" .$row['solution'] . "</td> "
echo 
"<td style='color: #666666;text-align:left;font-size:small;font-family:Tahoma'>" .$row['comments'] . "</td>"
echo 
"<td style='color: #666666;text-align:left;font-size:small;font-family:Tahoma'>" .$row['rf'] . "</td></tr>"



?>

Reply With Quote
  #32  
Old August 14th, 2008, 12:23 PM
jadi's Avatar
jadi jadi is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2008
Location: New Jersey, USA
Posts: 190 jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 7 h 24 m 28 sec
Reputation Power: 4
hey ur code worked

It gave me the output :
Array
(
[c_id] => 125
[problem] => Misc - Hardware related
[solution] => Being Monitered.......
[comments] => ON THE 6PM REPORT TECH FOUND THREE RADIOS LOCKED WILL MONITOR
[username] => pamato
[date] => 2008-08-14
[rf] => no
)

Reply With Quote
  #33  
Old August 14th, 2008, 12:24 PM
jsampsonPC's Avatar
jsampsonPC jsampsonPC is offline
stick a scissor in you eye
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2004
Location: Pensacola, Florida
Posts: 1,572 jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 15 h 37 m 59 sec
Reputation Power: 434
What does the link look like that opens that page? Are you positive you're sending the value across still?
__________________
FREE Web Development Videos | PHP Reference | MySQL Reference | jQuery Documentation

Markup Validation | CSS Validation | Web Developers, get FireBug & IE Developer Toolbar

When seeking help:
Submit clear questions and code. Use syntax highlighting.
Be patient, and respectful. Don't abuse your access to
professional guidance - nobody here is obligated to answer
your questions, be thankful that they do.

Are you a good person?

Reply With Quote
  #34  
Old August 14th, 2008, 12:25 PM
jsampsonPC's Avatar
jsampsonPC jsampsonPC is offline
stick a scissor in you eye
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2004
Location: Pensacola, Florida
Posts: 1,572 jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 15 h 37 m 59 sec
Reputation Power: 434
Quote:
Originally Posted by jadi
hey ur code worked

It gave me the output :
Array
(
[c_id] => 125
[problem] => Misc - Hardware related
[solution] => Being Monitered.......
[comments] => ON THE 6PM REPORT TECH FOUND THREE RADIOS LOCKED WILL MONITOR
[username] => pamato
[date] => 2008-08-14
[rf] => no
)

Bah, you're confusing me now! One minute it doesn't work, and the next it does - make up your mind! Haha. Okay, so tell me when you're ready to continue.

Reply With Quote
  #35  
Old August 14th, 2008, 12:26 PM
jadi's Avatar
jadi jadi is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2008
Location: New Jersey, USA
Posts: 190 jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 7 h 24 m 28 sec
Reputation Power: 4
I am ready now..............!!

Reply With Quote
  #36  
Old August 14th, 2008, 12:27 PM
jsampsonPC's Avatar
jsampsonPC jsampsonPC is offline
stick a scissor in you eye
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2004
Location: Pensacola, Florida
Posts: 1,572 jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 15 h 37 m 59 sec
Reputation Power: 434
Alright, so of the information that we successfully extracted from the db, what do you want to allow them to edit in the form?

Reply With Quote
  #37  
Old August 14th, 2008, 12:30 PM
jadi's Avatar
jadi jadi is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2008
Location: New Jersey, USA
Posts: 190 jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 7 h 24 m 28 sec
Reputation Power: 4
Well, they definitely cannot edit C_id , date & CELLID

They can only edit Problem, Solution, Comments & RF

Comments can be reposted in the textbox but Problem and Solution is just the same drop downs but just displayed with the selected value of the one they are trying to edit.

Reply With Quote
  #38  
Old August 14th, 2008, 12:47 PM
jsampsonPC's Avatar
jsampsonPC jsampsonPC is offline
stick a scissor in you eye
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2004
Location: Pensacola, Florida
Posts: 1,572 jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 15 h 37 m 59 sec
Reputation Power: 434
Alright, so let's build our form - once you have this done, we'll setup the auto-select for the dropdown, and the checkbox. You can also design your form here too the way you want it:

php Code:
Original - php Code
  1. # Note, we should watch these values closely!
  2. $commentid = $_GET["c_id"];
  3. $comment = getComment($commentid);
  4.  
  5. $form = "<form method='post'>
  6.            <p><input type='text' name='comment' value='{$comment["comments"]}' /></p>
  7.            <p>
  8.              <select name='problem'>
  9.                ...put your options here...
  10.              </select>
  11.            </p>
  12.            <p>
  13.              <input type='checkbox' name='rf' />
  14.            </p>
  15.            <p>
  16.              <input type='hidden' name='cid' value='{$commentid}' />
  17.              <input type='submit' name='update' value='Update' />
  18.            </p>
  19.          </form>";
  20.  
  21. print $form;
  22.  
  23. function getComment($commentid) {
  24.   $comment = array();
  25.   $sql = "SELECT id, problem, solution, comments, username, date, rf
  26.           FROM comments
  27.           WHERE id = {$commentid}";
  28.   $rst = mysql_query($sql) or die(mysql_error());
  29.   if (mysql_num_rows($rst) > 0) {
  30.     $comment = mysql_fetch_assoc($rst);
  31.   }
  32.   return $comment;
  33. }

Last edited by jsampsonPC : August 14th, 2008 at 12:50 PM.

Reply With Quote
  #39  
Old August 14th, 2008, 12:58 PM
jadi's Avatar
jadi jadi is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2008
Location: New Jersey, USA
Posts: 190 jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 7 h 24 m 28 sec
Reputation Power: 4
it gets the comments into the text box.
A drop down and a radio button:

TO GET THE VALUES INTO THE DROP DOWN I TRIED:
PHP Code:
<?php
$connection 
mysql_connect("localhost""root""") or die("Cannot connect to MySQL server: " mysql_error());
$db_selected mysql_select_db('tmetrix'$connection);


$commentid $_GET["c_id"];
$comment getComment($commentid);

$form "<form method='post'>
           <p><input type='text' name='comment' value='{$comment["comments"]}' /></p>
           <p>
          <select name="
problem">
                  <option selected="
selected" value=\"$comment[problem]\">$comment[problem]</option>
                  <option>High ICM specefic TRX</option>
                  <option>High ICM entire sector</option>
                  <option>Misc RF </option>
                <option>Misc - T1 / PCM </option>
                  <option>Misc - Hardware related</option>
                  <option>Misc - Sudden losses (BTS reset)</option>
                  <option>Misc - Sudden losses RF (Tunnels, IB, Terrain)</option>
                  <option>RF - SS DL specefic TRX</option>
                  <option>RF - SS DL entire sector</option>
                  <option>RF - SS UL specefic TRX </option>
                  <option>RF - SS UL entire sector </option>
                  <option>RF - SS BL coverage change </option>
                  <option>RF - QA DL specefic TRX</option>
                  <option>RF - QA DL entire sector </option>
                  <option>RF - QA UL specefic TRX</option>
                  <option>RF - QA UL entire sector </option>
                  <option>RF - QA BL specefic TRX</option>
                  <option>RF - QA BL entire sector</option>
                </select>







                      </p>
           <p>
             <input type='checkbox' name='rf' />
           </p>
         </form>"
;

print 
$form;

function 
getComment($commentid) {
  
$comment = array();
  
$sql "SELECT c_id, problem, solution, comments, username, date, rf 
          FROM comments 
          WHERE c_id = {$commentid}"
;
  
$rst mysql_query($sql) or die(mysql_error());
  if (
mysql_num_rows($rst) > 0) {
    
$comment mysql_fetch_assoc($rst);
  }
  return 
$comment;
}

?>


iT IS SAYING ERROR ON LINE 12

Parse error: syntax error, unexpected T_STRING in C:\WAMP\www\tmetrix\edit.php on line 12

Reply With Quote
  #40  
Old August 14th, 2008, 01:03 PM
jsampsonPC's Avatar
jsampsonPC jsampsonPC is offline
stick a scissor in you eye
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2004
Location: Pensacola, Florida
Posts: 1,572 jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 15 h 37 m 59 sec
Reputation Power: 434
Yeah; the error is from not escaping your double-quotes. But that isn't how you want to do the drop down selection anyway. Work on your drop-down until you have it working like the example in the code below. Each option in your <select> should look like this.

php Code:
Original - php Code
  1. print "<option value='Problem Text' ".(("Problem Text" == $comment["problem"]) ? "selected" : "").">{$comment["problem"]}</option>";

Last edited by jsampsonPC : August 14th, 2008 at 01:05 PM.

Reply With Quote
  #41  
Old August 14th, 2008, 01:06 PM
jadi's Avatar
jadi jadi is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2008
Location: New Jersey, USA
Posts: 190 jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 7 h 24 m 28 sec
Reputation Power: 4
i got it by changing " to '

Reply With Quote
  #42  
Old August 14th, 2008, 01:07 PM
jadi's Avatar
jadi jadi is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2008
Location: New Jersey, USA
Posts: 190 jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 7 h 24 m 28 sec
Reputation Power: 4
I did it for both the drop down but how can we do the radio button?

Reply With Quote
  #43  
Old August 14th, 2008, 01:08 PM
jsampsonPC's Avatar
jsampsonPC jsampsonPC is offline
stick a scissor in you eye
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2004
Location: Pensacola, Florida
Posts: 1,572 jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 15 h 37 m 59 sec
Reputation Power: 434
Your checkbox will be similar:

php Code:
Original - php Code
  1. print "<input type='checkbox' name='rf' ".(($comment["rf"] != "no") ? "checked" : )." />";

Reply With Quote
  #44  
Old August 14th, 2008, 01:09 PM
jsampsonPC's Avatar
jsampsonPC jsampsonPC is offline
stick a scissor in you eye
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2004
Location: Pensacola, Florida
Posts: 1,572 jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)jsampsonPC User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 15 h 37 m 59 sec
Reputation Power: 434
Quote:
Originally Posted by jadi
i got it by changing " to '

You should go back and do it the way I suggested. Don't get in the habbit of finding fixes when you need to be using solutions :P With your way you will have the same value in your dropdown twice, and that isn't what you want.

Reply With Quote
  #45  
Old August 14th, 2008, 01:17 PM
jadi's Avatar
jadi jadi is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2008
Location: New Jersey, USA
Posts: 190 jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level)jadi User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 1 Day 7 h 24 m 28 sec
Reputation Power: 4
Say if we make the radio button to dropdown with yes and no then I have a problem:

In the above drop downs, i am displaying all my options with the repeat of the chosen one.

But in yes or no i cant have 2 yes and 1 no or viseversa.

How can we solve this problem of reduenducy?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Edit problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
Stay green...Green IT