logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 07-16-2012, 07:09 PM   #1
sydesign
 
Join Date: Jan 2011
Posts: 41
Default PHP MySQL form error

I have a form set up to show events and when an admin is logged it it gives him the option to delete an event. Whenever i hit the delete form for some reason its not reading the whole event title. i have the events set up in a MySQL database and am echoing out the events. here is my code:

PHP Code:

              
include_once "connect_to_mysql.php";
              
$data mysql_query("SELECT * FROM calendar ORDER BY year, month, date DESC") or die(mysql_error()); 
              while(
$info mysql_fetch_array$data ))
               { 
               
                
$month ereg_replace("[^A-Za-z]"""$info['month']); // filter out numbers
                
$endmonth ereg_replace("[^A-Za-z]"""$info['endmonth']); // filter out numbers 
                
                
                
echo  "<form action='' method='post' enctype='multipart/form-data' name='form' id='form' onsubmit='return validate_form ( );'>
                       <table>
                         <tr>
                           <td width='300' valign='top' style='padding-right:10px;'>" 
.$month", " .$info['date']. 
                               
"&nbsp;" .$info['year']. " &mdash; " .$endmonth",&nbsp;" .$info['enddate']. "&nbsp;" .$info['endyear']. "</td>
                            <td width='440' style='padding-left:10px;' valign='top' >
                                <font size='+1' color='#179ceb'><strong>" 
.$info['event']. "</strong></font><br />" .$info['description']. "</td>
                            <td><select name='deleteevent'><option value=''><option value='delete'>delete event</select><br /><br />
                                <font size='-1' color='red'>*WARNING:<br /></font>
                                <font size='-4' color='red'>Delete action can NOT be undone.</font>
                                <input name='event2' type='hidden' id='event2' value=" 
.$info['event']. "/>
                                <input type='submit' name='delete' id='delete' value='Delete Event' />
                            </td>
                          </tr>
                        </table>
                        </form><br /><hr />"
;
               } 
PHP Code:

if (array_key_exists('delete'$_POST)) {
    
         include_once 
"connect_to_mysql.php";
      
$event2 $_POST['event2'];
      
$delete $_POST['deleteevent'];
      
$sql mysql_query("SELECT * FROM calendar"); 
      while(
$row mysql_fetch_array($sql)){
      }


    if (
$delete == "delete") {

        
$sql mysql_query("DELETE FROM calendar WHERE event='$event2'"); 
        
$successmsg '<div style=\'padding:10px; background-color:#333;\'><center><font color=\'#fff\'>The event "' .$event2'" has been deleted</font></center></div>
                       <br /><br />'
;
    
    } else if (
$delete == "") {
        
        
$successmsg '<div style=\'padding:10px; background-color:#333;\'><center><font color=\'#fff\'>Please select and event to be deleted</font></center></div>
                       <br /><br />'
;

    }

something happens from when i hit the delete user button to when it reads the form where it shows only the first word of the event title.


thank you for any help!
sydesign is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:03 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com