Jump to content

Recommended Posts


Hi all, I have a form which updates values in a dB table, is it possible from the same form to also insert a value into a different table? I just want to log the form users ip address with $_server['REMOTE_ADDR']; and use that ip later to limit form submission
Here is my form code:

form method="post" name="form2" action="<?php echo $editFormAction; ?>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right"><select name="broker_rating_two" onClick="DoSubmission2();">
<?php
do {
?>
<option value="<?php echo $row_valueset2['value']?>" <?php if (!(strcmp($row_valueset2['value'], $row_bprofile['broker_rating_two']))) {echo "SELECTED";} ?>><?php echo $row_valueset2['value']?></option>
<?php
} while ($row_valueset2 = mysql_fetch_assoc($valueset2));
?>
</select></td>
<td></td>
<tr>
</table>
<input type="hidden" name="id" value="<?php echo $row_bprofile['id']; ?>">
<input type="hidden" name="broker_num_votes_two" value="<?php echo $row_bprofile['broker_num_votes_two']; ?>">
<input type="hidden" name="MM_update" value="form2">
<input type="hidden" name="id" value="<?php echo $row_bprofile['id']; ?>">
</form>

HERE IS MY FORM ACTION CODE:

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE brokers SET broker_rating= broker_rating + %s, broker_num_votes=%s + 1 WHERE id=%s",
GetSQLValueString($_POST['broker_rating'], "int"),
GetSQLValueString($_POST['broker_num_votes'], "int"),
GetSQLValueString($_POST['id'], "int"));

mysql_select_db($database_broker, $broker);
$Result1 = mysql_query($updateSQL, $broker) or die(mysql_error());
}

APOLS FOR ALL THE CODE
Xtian
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.