Page 1 of 1

Frames

Posted: Mon Apr 09, 2007 4:04 am
by red
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi , everybody 

this is my html page, where a user enters a category name to be added to database. 

[syntax="html"]<form action="http://localhost/Admin/confcategory.php" method="post"> 
<h4>ADD new CATOGARY into the DataBase</h4><table cellspacing="1" cellpadding="1" width="75%" align="center" border="1" bgcolor="66CCFF"> 
<tr> 
<td> 
Enter the Catgory Name: <input type="text" name="CName"> 
<br> 
<br> 
<input type="submit" name="submit" value="submit"> 
<input type="Reset" value="Reset" size="20"> 
</td> 
</tr> 
</form> 

This is my PHP code confcategory .when a user clicks on submit on 1st page a data is directly added to database.[/syntax]

Code: Select all

<?php 
// Set global variables to easier names 
$cname = $_POST['CName']; 
$query ="insert into category(cname)". "VALUES ('".$cname."')"; 
$result = mysql_db_query($db_name,$query); 
if (!$result) { 
echo("ERROR: " . mysql_error() . "\n$query\n"); } 
else 
{ 
echo ("\nNew Link Added\n\n"); 
$q ="select * from category"; 
$r = mysql_db_query($db_name,$q); 
echo "<tr> CID CName "; 
while($row = mysql_fetch_array($r)) 
{ 
echo " \n"; 
echo "\n " . $row['CID'] . " "; 
echo "\n " . $row['CName'] . " "; 
echo " \n"; 
} 
} 
mysql_close( $link ); 
?>
My problem is ,when a user clicks on sumbit onclick an alert frame should be generated containing yes and no that is if a user clicks yes a data should be inserted ,if no is clicked no category name is inserted into database,returns to 1st page

How to do this Please helpme how to code a Frame containing a Yes and No option in frame


Please help!


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Mon Apr 09, 2007 10:20 am
by mentor
What about using Javascript alert when submitting page?

Code: Select all

<form action="http://localhost/Admin/confcategory.php" method="post" onsubmit="return confirm('Do you want to add data?')"> 
<h4>ADD new CATOGARY into the DataBase</h4>
<table cellspacing="1" cellpadding="1" width="75%" align="center" border="1" bgcolor="66CCFF"> 
<tr> 
<td> 
Enter the Catgory Name: <input type="text" name="CName"> 
<br> 
<br> 
<input type="submit" name="submit" value="submit"> 
<input type="Reset" value="Reset" size="20"> 
</td> 
</tr> 
</table>
</form>
I only changed <form> tag.

Posted: Mon Apr 09, 2007 11:21 am
by RobertGonzalez
Alerts come from Javascript and Javascript is client side, not server side.

table

Posted: Tue Apr 10, 2007 4:48 am
by red
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


This is my PHP code where i am select data From product table and displaying in a HTML table

Code: Select all

<? 
$q ="select * from product order by PID"; 
$r = mysql_db_query($db_name,$q); 
/* Output data into a HTMl table */ 
echo "<br><br><table bgcolor=yellow border=\"15\" align=center width=50%> "; 
echo "<tr><th>PID</th><th>PNAME</th></tr>"; 
echo "<tr>"; 
echo "<div color=\"#ffff00\">"; 
while ($field=mysql_fetch_field($r)) 
{ 
echo"<A><th>$field->PID</A></th>"; 
} 
echo "</font></tr>"; 
while($row = mysql_fetch_row($r)) { 
echo "<tr>"; 
for($i=0; $i < mysql_num_fields($r); $i++) { 
echo "<td align=center>$row[$i]</td>"; 
} 
echo "</tr>"; 
} 
echo "</table><BR><BR>"; 

mysql_close( $link ); 
?>
I am getting the output .But ,main prorblem is the table in leftside is extending the 2nd colum is small .
what shall i do i hv tried all possible outcomes ? Please help ........


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]