Jump to content

add a row to a table if more information is wanted


dbdummy

Recommended Posts

i have a row in a table that contains 3 columns of information to an event. if they want to add another event (row), i somehow want (perhaps a 4th column that has a button, add another event. and then that whole row would repeat itself in the table.

 

<tr>
<td>Event</td>
<td>
<select name="event" id="event">
<option selected="selected">Select Event Type</option>
<?php
do {  
	echo "<option value=\"".$row_event['eventId']"".
	if ($row_event['eventId'] == $row_eventName['eventName']){
				echo "selected=\"selected\"". ">".$row_event['eventName'];."</option>";
}
while ($row_event = mysql_fetch_assoc($event));
?>
</select>
</td>
<td><select name="event" id="event" multiple size="4">
<option selected="selected">Select Date(s)</option><?php
$date = mktime(0,0,0);
for ($i=0; $i<90; $i++)
{
    $d1 = date('Y-m-d', $date);
    $d2 = date('M d Y', $date);
    echo "<option value='$d1'>$d2</option>\n";
    $date = strtotime('+1 days', $date);
}
?>
</select>
</td>
</tr>

Link to comment
Share on other sites

There isnt a question there!! If u want to add a row from a button press, make a form with the data to be inputed and a submit button. Send those data with post and:

 

if(isset($_POST['variable']){
    $var1 = mysql_real_escape_string($_POST['var1']);
    $var2 = mysql_real_escape_string($_POST['var2']);
    $query = @mysql_query("INSERT INTO table (col1, col2) VALUES ('$var1', '$var2')") or die(mysql_error());
    echo "Your data were added.";
}

 

If this is what u mean anyway.

Link to comment
Share on other sites

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.