Codes here !
Moderators: macek, egami, gesf
by webwired » Wed Dec 11, 2002 11:16 am
I don't know what's up with your code, but it's nearly impossible to look at... but here, I've included an insert form for you to look at
- Code: Select all
<html>
<body>
<center>
<?php
if(!$submit)
{
?>
<form action="<?php $PHP_SELF ?>" method="post">
<table width="500" bordercolor="#000000" cellspacing="0" cellpadding="2" border="1">
<tr>
<td> Field1</td>
<td>
<input type="text" name="field1" size="35">
</td>
</tr>
<tr>
<td> Field2</td>
<td>
<input type="text" name="field2" size="35">
</td>
</tr>
<tr>
<td> Field3</td>
<td>
<input type="text" name="field3" size="35">
</td>
</tr>
<tr>
<td> Field4</td>
<td>
<input type="text" name="field4" size="35">
</td>
</tr>
<tr>
<td colspan=2>
<center>
<input type="submit" name="submit" value="Add">
</center>
</td>
</tr>
</table>
</form>
<?php
}else{
?>
<form action="<?php $PHP_SELF ?>" method="post">
<table width="500" bordercolor="#000000" cellspacing="0" cellpadding="2" border="1">
<tr>
<td> Field1</td>
<td>
<input type="text" name="field1" size="35">
</td>
</tr>
<tr>
<td> Field2</td>
<td>
<input type="text" name="field2" size="35">
</td>
</tr>
<tr>
<td> Field3</td>
<td>
<input type="text" name="field3" size="35">
</td>
</tr>
<tr>
<td> Field4</td>
<td>
<input type="text" name="field4" size="35">
</td>
</tr>
<tr>
<td colspan=2>
<center>
<input type="submit" name="submit" value="Add">
</center>
</td>
</tr>
</table>
</form>
<?php
include_once "../../cgi-bin/includes/ez_sql.php";
$sqlquery = "INSERT INTO yourtable VALUES ('$field1','$field2','$field3','$field4')";
$results = mysql_query($sqlquery);
mysql_close();
?>
<?php
}
?>
</center>
</body>
</html>
-

webwired
- New php-forum User

-
- Posts: 26
- Joined: Sat Nov 23, 2002 5:20 pm
- Location: St. Louis, Missouri
-
Return to mySQL & php coding
Who is online
Users browsing this forum: No registered users and 1 guest