/    Sign up×
Community /Pin to ProfileBookmark

how we can select

Hi,

Tell me ,when we go to the edit page by a link then element should be selected which have been entered in the database in the issue date field becouse there are 3 dropdown.Tell me what is the code for it coz i am in trouble.

The code is:-
<?
session_start();
if(trim($_SESSION[“login_memberid”])==””)
header(“location:index.php”);

include(“header.php”);
include(“label.php”);
include(“connection.php”);

print'<body bgcolor=”#F8E1D0″ topmargin=”0″ leftmargin=”0″>’;
$query=”SELECT * FROM books WHERE book_id='”.$_GET[‘book_id’].”‘”;

$result=mysql_query($query);

$fetch=mysql_fetch_array($result);

$book_id=$fetch[“book_id”];
$book_name=$fetch[“book_name”];
$author_name=$fetch[“author_name”];
$publisher_name=$fetch[“publisher_name”];
$no_of_copies=$fetch[“no_of_copies”];
$issue_date=$fetch[“issue_date”];
$status=$fetch[“status”];

?>
<FORM METHOD=POST ACTION=”query_update.php” name=”edit”>

<TABLE align=”center” width=”80%” cellspacing=”5″ cellpadding=”0″ border=”0″ >
<TR>
<TD>
<TABLE width=”60%” align=”center” cellspacing=”0″ cellpadding=”0″ border=”0″>
<TR>
<TD width=”24px” align=left><IMG SRC=”Images/new_left.gif” WIDTH=”25″ HEIGHT=”25″ BORDER=”0″ ALT=””></TD>
<TD COLSPAN=2 bgcolor=”#F28F45″>&nbsp; </TD>
<TD width=”24px” align=”right”> <IMG SRC=”Images/new_right.gif” WIDTH=”25″ HEIGHT=”25″ BORDER=”0″ ALT=””></TD>
</TR>

<TR HEIGHT=40 >
<TD border=0 style=”border-left:1px solid #F28F45;”> &nbsp; </TD>
<TD align=RIGHT ><B> <font face=”Times New Roman” color=”BLACK”> Book Name &nbsp;&nbsp; </font> </B> </TD>
<TD align=”left”><INPUT TYPE=”text” NAME=”book_name” value=<?=$book_name?> size=”27″ ></TD>
<TD style=”border-RIGHT:1px solid #F28F45;”> &nbsp; </TD>
</TR>
<TR HEIGHT=40 >
<TD border=0 style=”border-left:1px solid #F28F45;”> &nbsp; </TD>
<TD align=RIGHT ><B> <font face=”Times New Roman” color=”BLACK”> Author Name &nbsp;&nbsp; </font> </B> </TD>
<TD align=”left”><INPUT TYPE=”text” NAME=”author_name” value=<?=$author_name?> size=”27″ ></TD>
<TD style=”border-RIGHT:1px solid #F28F45;”> &nbsp; </TD>
</TR>
<TR HEIGHT=40 >
<TD border=0 style=”border-left:1px solid #F28F45;”> &nbsp; </TD>
<TD align=RIGHT ><B> <font face=”Times New Roman” color=”BLACK”> Publisher Name &nbsp;&nbsp; </font> </B> </TD>
<TD align=”left”><INPUT TYPE=”text” NAME=”publisher_name” value=<?=$publisher_name?> size=”27″ ></TD>
<TD style=”border-RIGHT:1px solid #F28F45;”> &nbsp; </TD>
</TR>
<INPUT TYPE=”hidden” NAME=”no_of_copies” value=”1″>

<?
print'<TR HEIGHT=40 >
<TD border=0 style=”border-left:1px solid #F28F45;”> &nbsp; </TD>’;
print'<TD align=RIGHT ><B> <font face=”Times New Roman” color=”BLACK”> Issue Date &nbsp;&nbsp; </font> </B> </TD>’;
?>
<TD align=”Left”><select NAME=”issue_day” >
<?
while($d<=31)
{
print”<option>$d”;
$d++;
}

print’ </select>
<select NAME=”issue_month” >’;
while($m<=12)
{
print”<option>$m”;
$m++;
}

print'</option>
</select>
<select NAME=”issue_year”><option></option>’;
$y=2005;
while($y<=2010)
{
print”<option>$y”;
$y++;
}

print'</option>
</select>
</TD>
<TD style=”border-RIGHT:1px solid #F28F45;”> &nbsp; </TD>
</tr>

<br>’;

$query=”select * from members”;
$result=mysql_query($query);

print'<TR HEIGHT=40 >
<TD border=0 style=”border-left:1px solid #F28F45;”> &nbsp; </TD>

<TD align=RIGHT ><B> <font face=”Times New Roman” color=”BLACK”> AssignedTo &nbsp;&nbsp; </font> </B> </TD>’;

?>
<TD><SELECT NAME=”status”><option value=0>—-</option>
<?

while($row=mysql_fetch_array($result))
{

if($row[“member_id”]==$status)
{
?>
<option SELECTED value=”<?=$row[‘member_id’]?>”><?=$row[‘login_memberid’]?></option>
<?
}

else
{

?>
<option value=”<?=$row[‘member_id’]?>”><?=$row[‘login_memberid’]?></option>
<?
}
}

print'</SELECT> </TD>

<TD style=”border-RIGHT:1px solid #F28F45;”> &nbsp; </TD>
</TR>’;

print'<TR HEIGHT=40>
<TD style=”border-left:1px solid #F28F45;”> &nbsp; </TD>
<TD> &nbsp; </TD>
<TD align=”left”><INPUT TYPE=”submit” value=”Save”><INPUT TYPE=”hidden” name=”book_id” value=’.$_GET[‘book_id’].’><INPUT TYPE=”hidden” name=”flag” value=6><INPUT TYPE=”button” value=”Cancel” onclick=”javascript:location.href=’books.php'”></TD>

<TD style=”border-RIGHT:1px solid #F28F45;”> &nbsp; </TD>
</TR

<TR>
<TD><IMG SRC=”Images/Bottom_left.gif” WIDTH=”25″ HEIGHT=”25″ BORDER=”0″ ALT=””></TD>
<TD COLSPAN=2 bgcolor=”#F28F45″>&nbsp; </TD>
<TD align=”left”><IMG SRC=”Images/Bottom_right.gif” WIDTH=”25″ HEIGHT=”25″ BORDER=”0″ ALT=””></TD>
</TR>

</TABLE>
</TD>
</TR>
</TABLE>

</FORM>’;
?>

<?

include(“footer.php”);
?>
</body>

Plzz give me reply quickly.

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@chazzyJan 14.2006 — it seems like you have it just fine in your code
[code=php]
if($row["member_id"]==$status)
{
?>
<option SELECTED value="<?=$row['member_id']?>"><?=$row['login_memberid']?></option>
<?
}


else
{

?>
<option value="<?=$row['member_id']?>"><?=$row['login_memberid']?></option>
<?
}
[/code]
Copy linkTweet thisAlerts:
@CytaelJan 15.2006 — partial thread hijack here, but:

is it possible to start php blocks with just "<?" like that?

what's the difference between "<?" and "<?php" ?
Copy linkTweet thisAlerts:
@bathurst_guyJan 15.2006 — Depends on how the server is set-up, most servers allow for the short name, the only difference is if you relocate servers and the new one doesnt allow it
Copy linkTweet thisAlerts:
@NogDogJan 15.2006 — As b_g alludes to, "<?php" should always work on any server which supports PHP, while "<?" may or may not work. Therefore, I always use "<?php" so I don't have to worry about portability.
Copy linkTweet thisAlerts:
@ShrineDesignsJan 15.2006 — the <?php ... ?> will always work, <? ... ?> should be avoided for cross platform compatibility and/or if you use xml <?xml ... ?> markup in php files, php will try to parse the xml block thinking it is php
×

Success!

Help @parveen spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...