Jump to content

smoreno

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

smoreno's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok basically I know little to nothing about php, but I am helping make this website. I've read a couple of tutorials but I just can’t seem to get it for some reason. Basically the site needs to have an announcements page. People are able to post announcements and then they show up, I got this part figured out. Now though, I need a page where I can see the announcements data in a form that it can be edited by a user on the website. Page where data is displayed: [code] <?php    $link = mysql_connect("mysql", "name", "pwrd");    mysql_select_db("announcements");        /* Performing SQL query */     $query = "SELECT * FROM announce";     $result = mysql_query($query) or die("Query failed");     /* Printing results in HTML */     print "<table>\n";     while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {         print "\t<tr>\n";         foreach ($line as $col_value) {             print "\t\t<td>$col_value</td>\n";         }         print "\t</tr>\n";     }     print "</table>\n";     /* Free resultset */     mysql_free_result($result);     /* Closing connection */     mysql_close($link);   ?>[/code] Page where data is submitted: [code]<form name="form1" method="post" action="insert_it.php">    <table width="100%" border="0" cellpadding="5" cellspacing="0">   <tr>     <td valign="top"> Announcement</td>     <td> <textarea name="announce" cols="40" rows="10"></textarea> </td></tr> <tr> <table width="50%" border="0" cellpadding="5" cellspacing="0"> <tr> <td width="25%">Show Annoucement?</td> <td width="25%"> <input type="radio" name="display" value="Y">Yes </td> <td> <input type="radio" name="display" value="N">No </td> </tr> </table> </tr> <tr><td><input type="submit" name="Submit" value="Submit"></td></tr> </table> </form> [/code] Page you are brought to after you hit submit: [code]<?php $link = mysql_connect("mysql", "user", "pwrd");    mysql_select_db("announcements");    $query = "INSERT INTO announce (text, display) VALUES ('$announce', '$display')";     $results = mysql_query($query) or die(mysql_error()); echo $result; echo $query; mysql_close(); print "<html><body><center>"; print "<p>You have just entered this record<p>"; print "Name : $announce<br>"; print "</body></html>"; ?> [/code] I just need a page where the data that has been entered can be edited. If anyone could help it would be greatly appreciated. Thanks!
  2. I am currently using yahoo as a host, and they supply a mysql server, and they support php. I am very new to php and I am having trouble figuring out how to get data from the database and being able to edit it. Basically, on my page, I want an announcements section. I want this data to be editable though, but only by certain people. I have made a page that is password protected, I only need the codeing that would allow them to edit it. So, 2 pages, one that pulls the data from the database and displays it, and a page that allows that data to be edited. Could anyone help me with this or lead me to a website that would show me how? Thanks!
×
×
  • 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.