Jump to content

[SOLVED] stumped


coalduststar

Recommended Posts

i'm using dreamweaver to set up some admin pages for a site that i'm doing. I'm currently doing a page that lists the news items in the database next to radiobuttons that carry the news item ID. The form on that page then submits to a second page which is supposed to display the values from the selected article for editting.

For some reason the articles won't display and as far as i can see i've named everything correctly. I don't think it's a permission problem or anything because displaying records done from that same database in other sections of the site- please help!

[b]This is editevent.php[/b]
[code]<?php require_once('../Connections/contacts.php'); ?>
<?php
mysql_select_db($database_contacts, $contacts);
$query_editnews = "SELECT * FROM events ORDER BY ev_id DESC";
$editnews = mysql_query($query_editnews, $contacts) or die(mysql_error());
$row_editnews = mysql_fetch_assoc($editnews);
$totalRows_editnews = mysql_num_rows($editnews);
?>....

<div id="admin">
 
  <h4>Please select an item to edit...</h4>
<form action="editevent2.php" method="GET" name="editnews">
  <?php do { ?>
    <p><input name="ev_ID" type="radio" value="<?php echo $row_editnews['ev_id']; ?>" /><?php echo $row_editnews['ev_title']; ?><hr />
    </p>
    <?php } while ($row_editnews = mysql_fetch_assoc($editnews)); ?>
  <input name="" type="submit" value="display" />
</form>
</div>...

<?php
mysql_free_result($editnews);
?>

[/code]

[b]which submits to this page:[/b]
[code]
<?php require_once('../Connections/contacts.php'); ?>
<?php
mysql_select_db($database_contacts, $contacts);
$query_editnews = "SELECT * FROM events ORDER BY ev_id DESC";
$editnews = mysql_query($query_editnews, $contacts) or die(mysql_error());
$row_editnews = mysql_fetch_assoc($editnews);
$totalRows_editnews = mysql_num_rows($editnews);
?>...


<div id="admin">

  <h4>Make the changes...</h4>
  <table width="450px">
<form action="<?php echo $editFormAction; ?>" name="addnews" method="POST">

<tr><td align="left">Event Title:</td>
<td><input name="ev_title" type="text" value="<?php echo $row_addnews['ev_title']; ?>" /></td></tr>

<tr><td align="left">Event Date:</td>
<td><input name="ev_date" type="text" id="ev_date" value="<?php echo $row_addnews['ev_date']; ?>" />
<img src="calendar.gif" width="16" height="16" onclick="showChooser(this, 'ev_date', 'chooserSpan', 1950, 2010, 'Y-m-d', false);">
<div id="chooserSpan" class="dateChooser select-free" style="display: none; visibility: hidden; width: 160px;"></div> </td></tr>

<tr><td align="left">Event Time:</td>
<td><input name="ev_time" type="text" value="<?php echo $row_addnews['ev_time']; ?>" /></td></tr>

<tr><td align="left">Event Venue:</td>
<td><input name="ev_venue" type="text" value="<?php echo $row_addnews['ev_venue']; ?>" /></td></tr>
<tr><td colspan="2">
<input type="button" class="button" accesskey="b" name="addbbcode0" value=" B " onclick="bbstyle(0)"  />
<input type="button" class="button" accesskey="i" name="addbbcode2" value=" <h1> " onclick="bbstyle(2)" />
<input type="button" class="button" accesskey="u" name="addbbcode4" value=" <h3> " onclick="bbstyle(4)" />
<input type="button" class="button" accesskey="p" name="addbbcode14" value="Img" onClick="bbstyle(14)" />
<input type="button" class="button" accesskey="w" name="addbbcode16" value="Link" onclick="bbstyle(16)" />

<select name="addbbcode18" onchange="bbfontstyle('<span style=color:' + this.form.addbbcode18.options[this.form.addbbcode18.selectedIndex].value + ';>', '</span>');this.selectedIndex=0;">
<option style="color:black; background-color: #" value="#">colour</option>
<option style="color:darkred; background-color: #" value="darkred">Dark Red</option>
<option style="color:red; background-color: #" value="red">Red</option>
<option style="color:orange; background-color: #" value="orange">Orange</option>
<option style="color:brown; background-color: #" value="brown">Brown</option>
<option style="color:yellow; background-color: #" value="yellow">Yellow</option>

<option style="color:green; background-color: #" value="green">Green</option>
<option style="color:olive; background-color: #" value="olive">Olive</option>
<option style="color:cyan; background-color: #" value="cyan">Cyan</option>
<option style="color:blue; background-color: #" value="blue">Blue</option>
<option style="color:darkblue; background-color: #" value="darkblue">Dark Blue</option>
<option style="color:indigo; background-color: #" value="indigo">Indigo</option>

<option style="color:violet; background-color: #" value="violet">Violet</option>
<option style="color:white; background-color: #" value="white">White</option>
<option style="color:black; background-color: #" value="black">Black</option>
</select>

<select name="addbbcode20" onchange="bbfontstyle('<span style=font-size:' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ';>', '</span>')">
<option value="7" class="genblack">Tiny</option>
<option value="9" class="genblack">Small</option>

<option value="12" selected class="genblack">size</option>
<option value="18" class="genblack">Large</option>
<option  value="24" class="genblack">Huge</option>
</select>

<a href="javascript:bbstyle(-1)">Close Tags</a>

</td></tr>
<tr><td align="left">Event Description:</td>
<td><textarea name="ev_desc" cols="40" rows="10" wrap="virtual" tabindex="3" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);"><?php echo $row_addnews['ev_desc']; ?></textarea></td></tr>
<tr>
  <td colspan="2"><input name="ev_id" type="hidden" value="<?php echo $row_addnews['ev_id']; ?>" /></td>
</tr>
<tr><td colspan="2" align="center"><input name="" type="submit" value="edit"/></td></tr>
<input type="hidden" name="MM_update" value="addnews">
</form>
</table>
</div>...


<?php
mysql_free_result($addnews);
?>[/code]
Link to comment
Share on other sites

On the page you submit to, you query is as follows:

[code]$query_editnews = "SELECT * FROM events ORDER BY ev_id DESC";[/code]

Surely to only retrieve the row you selected with the radio button it should be somthing along the lines of:

[code]$query_editnews = "SELECT * FROM events WHERE ev_id=".$_GET['ev_id']." ORDER BY ev_id DESC";

[/code]
Link to comment
Share on other sites

  • 2 weeks later...
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.