Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok dito

Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

Question..

Papano ko naman po ito maeedit yung checkbox and radio via php code??

dun sa view.php

Code:
<?php 
     
    if(isset($_GET['id'])){
           $id = $_GET['id];
     }else{
           exit();
     }

     //from here the query
     $sql = mysql_query("SELECT COUNT(*) as cnt  FROM tablename WHERE id='".$id.'"); // count mo muna if existing talaga ang id 

     $count_sql = mysql_fetch_object($sql);
     
     if($count_sql->cnt ==0){
         
            echo "Theres no user with id = '.$id.'";
     }else{
              $get_user = mysql_query("SELECT * FROM tablename WHERE id ="".$id."" LIMTI 1");
              $sqlrows = mysql_fetch_assoc($getuser);

              $gender = $sqlrows['fieldname'];
              $checked[$gender] = "checked";
              
             //here is the rest of the fields
             <form>
               <input  type="radio" id = "gender" name="gender"  value="Male"'.(($checked["Male"]) ? 'checked="checked"': '').'>Male</input>

               <input  type="radio" id = "gender" name="gender"  value="Female"'.(($checked["Female"]) ? 'checked="checked"': '').'>Female</input>
             </form>
             
             //I assume you know na how to code with the submit button  if not, just let me know po.. thnx.. 
     }
?>
 
Last edited:
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

dun sa view.php

Code:
             //I assume you know na how to code with the submit button  if not, just let me know po.. thnx.. 
     }
?>

Sir Nitz, hindi ko po magets.

Heto po view.php ko.
<?php
require("db.php");
$id =$_REQUEST['id'];

$result = mysql_query("SELECT * FROM nyfdata WHERE id = '$id'");
$test = mysql_fetch_array($result);
if (!$result)
{
die("Error: Data not found..");
}
$fname=$test['fname'] ;
$lname= $test['lname'] ;
$email=$test['email'] ;
$contact=$test['contact'] ;
$gender=$test['gender'] ;
$unit=$test['unit'] ;

if(isset($_POST['save']))
{
$fname_save = $_POST['fname'];
$lname_save = $_POST['lname'];
$email_save = $_POST['email'];
$contact_save = $_POST['contact'];
$gender_save = $_POST['gender'];
$unit_save = $_POST['unit'];

mysql_query("UPDATE nyfdata SET fname ='$fname_save', lname ='$lname_save',
email ='$email_save',contact ='$contact_save', gender ='$gender_save', unit ='$unit_save' WHERE ID = '$id'")
or die(mysql_error());
echo "Saved!";

header("Location: edit.php");
}
mysql_close($conn);
?>
<!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>Admin - Edit</title>
</head>

<body>
<form method="post">
<table border="0">
<tr>
<td>First Name</td>
<td><input type="text" name="fname" value="<?php echo $fname ?>"/></td>
</tr>
<tr>
<td>Last Name</td>
<td><input type="text" name="lname" value="<?php echo $lname ?>"/></td>
</tr>
<tr>
<td>email</td>
<td><input type="text" name="email" value="<?php echo $email ?>"/></td>
</tr>
<tr>
<td>contact</td>
<td><input type="text" name="contact" value="<?php echo $contact ?>"/></td>
</tr>
<tr>
<td>gender</td>
<td><input type="radio" name="gender" id="gender" />
Male <input type="radio" name="gender" id="gender" />
Female <input type="text" name="contact" value="<?php echo $gender ?>"/></td>
</tr>
<tr>
<td>unit</td>
<td><input type="text" name="unit" value="<?php echo $contact ?>"/></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="save" value="save" /></td>
</tr>
</table>

</body>
</html>
san ko po ilalagay?
Thank you.
 
Last edited:
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

antayin ko po sir Nitz.
Pakiayos na rin po.
Im preparing kasi on how to make a CMS website for my project, so im working on small steps first.
Salamat.
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

antayin ko po sir Nitz.
Pakiayos na rin po.
Im preparing kasi on how to make a CMS website for my project, so im working on small steps first.
Salamat.

Ceril, see attachment. Minodefy ko ng kunti yung file saka codes. Just let me know if may error ha, hindi ko kasi na test talaga.
 

Attachments

  • view.rar
    1.3 KB · Views: 5
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

Ceril, see attachment. Minodefy ko ng kunti yung file saka codes. Just let me know if may error ha, hindi ko kasi na test talaga.

Sir Nitz. error po.

"unexpected T_CONSTANT_ENCAPSED_STRING in driverletter:\xampp\htdocs\NYF\view.php on line 60"

papano po??


and tama ba yung ginawa ko sa taas na..
if(isset($_POST['save']))
{
$fname_save = $_POST['fname'];
$lname_save = $_POST['lname'];
$email_save = $_POST['email'];
$contact_save = $_POST['contact'];
$gender_save = $_POST['gender'];
$unit_save = $_POST['unit'];
???

Heto yung fields na nagawa sa phpmyadmin ko.
id
created_at
fname
lname
gender - Female --------RADIO
gender - Male --------RADIO
email
contact
unit
planofbooking - W/ Group --------RADIO
planofbooking - Personal --------RADIO
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

Sir Nitz. error po.

"unexpected T_CONSTANT_ENCAPSED_STRING in driverletter:\xampp\htdocs\NYF\view.php on line 60"

papano po??


and tama ba yung ginawa ko sa taas na..

???

Heto yung fields na nagawa sa phpmyadmin ko.
id
created_at
fname
lname
gender - Female --------RADIO
gender - Male --------RADIO
email
contact
unit
planofbooking - W/ Group --------RADIO
planofbooking - Personal --------RADIO


ito na yung file, fixed na yan.. replace mo nlang yung luma ha..
follow mo nlng yung format ng gender para dun sa plan of booking.. ok? gud luck..
 

Attachments

  • view.rar
    1.3 KB · Views: 4
Last edited:
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

ceril, meron na.. yung previous reply ko.. andun na .. ^_^

Sir Nitz, error po line 24.
mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\NYF\view.php on line 25
Error: Data not found..

Post ko dito buong code ko, okay lang po ba?
 

Attachments

  • sample.zip
    2.7 KB · Views: 9
Last edited:
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

Sir Nitz, error po line 24.


Post ko dito buong code ko, okay lang po ba?

hehe sorry hindi ko napalitan yung line na to

Code:
$result = mysql_query("SELECT * FROM info WHERE id ='".$id."' LIMIT 1");

kasi yung table na ginamit ko info d2 sa local server ng pc ko, palitan mo yung tablename nung sau

sa may SELECT * FROM tablename
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

Sir Nitz, okay na po. nakuha ko na yun ang problem ko po is hindi na siya naguupdate.
how is this?

and yung gender ko po na radio button.
Paayos naman po.
Need ko talaga malaman basics nito. para sa aking CMS.

pacheck mo ng attached file ko na sample.zip
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

Sir Nitz, okay na po. nakuha ko na yun ang problem ko po is hindi na siya naguupdate.
how is this?

and yung gender ko po na radio button.
Paayos naman po.
Need ko talaga malaman basics nito. para sa aking CMS.

pacheck mo ng attached file ko na sample.zip


^_- ok, hmm.. till 5pm lang ako d2 sa office, urgent ba to?
bukas ko nlng update.. ok lang ? ^_^ hehe
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

hhmm.. if kaya po sana then please do so, konti lang naman po ito since basic pa.
But still, kayo po bahala..
Thank you soo much Sir Nitz.
Maraming salamant.
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

Sir Nitz, okay na po. nakuha ko na yun ang problem ko po is hindi na siya naguupdate.
how is this?

and yung gender ko po na radio button.
Paayos naman po.
Need ko talaga malaman basics nito. para sa aking CMS.

pacheck mo ng attached file ko na sample.zip


ahaha.. kaya pala.. tiningnan ko yung structure ng table mo
hehe.. medyo may mali sa structure nya.. cge fixed ko nlng pati table ha..
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

ahaha.. kaya pala.. tiningnan ko yung structure ng table mo
hehe.. medyo may mali sa structure nya.. cge fixed ko nlng pati table ha..

ginawa ko po kasi yung gamit ang Coffe Cup Webform Builder, then siya na po yung nagcreate nung table sa Database ko.
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

mga ka symbianize..nagtataka lang po ako...ung mga jquery slideshows na nki2ta laging may file na jquery-1.3.2.min need ba talaga tong file na 2 para mag run ung jquery / jscript?
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

mga ka symbianize..nagtataka lang po ako...ung mga jquery slideshows na nki2ta laging may file na jquery-1.3.2.min need ba talaga tong file na 2 para mag run ung jquery / jscript?

yan po yung Jquery mismo sir.
needed yan para sa mga jquery plugins
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

sana marami poh akong matutunan dito pra sa system namin..salamat poh:thumbsup::thumbsup::thumbsup:
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

sana naman po may tumulong sa akin...about phpexcel...please lang po...thesis ko ron po ito...
patulong naman...pm nalang me po...para sigurado...please.....
 
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2

San mo gagamitin sir? For reading ba or writing?

meron akung ginamit, phpexcellreader name niya.
I used it to parse xls file into mysql database..

Yung phpexcell naman its more on writing xls ata. Kasi halos ganun lahat yung mga nasa sample niya. Tsaka maxadong malaki yung phpexcell kung di mo naman kelangan ng ganung kadaming features..
 
Back
Top Bottom