Jump to content

Help with code


steviez

Recommended Posts

Hi,

 

I have a form on my site that i want to display a success message or page upon submit. Also i dont want the data that was in the firleds to be there after submit. The code is messy but any help would be great!

 

The code is as follows:

 

<?php

ob_start();
include("connect.php");
include("header.php");
if(!$UsErId)
{
$redirect = $SITEURL."login.php";
header("Location:$redirect");
}
if($action_save != '')
{
if(($field_title != '') && ($field_descr != ''))
{
	$insert_playlist = "insert into playlist (playlist_name,description,tags,privacy,user_id) values('$field_title','$field_descr','$field_keywords','$field_privacy','$UsErId')";
	$result_playlist = mysql_query($insert_playlist);
}
else
{
	$ERROR = "Please check required Fields";
}
}
?>

<table align="center" width="780" class="frame">
  <tr>
    <td valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="6"><img src="<?php echo $SITEURL ?>images/1x1.gif" width="1" height="1" alt="" /></td>
          <td align="left" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td valign="top"><table class="page_content_frame" width="100%">
                    <tr>
                      <td height="13" align="left" valign="top"><img src="<?php echo $SITEURL ?>images/1x1.gif" width="1" height="1" alt="" /></td>
                    </tr>
                    <tr>
                      <td align="left" valign="top"><table width="700">
                          <tr valign="top">
                            <td width="700" valign="top" align="left"></td>
                          </tr>
                          <tr>
                            <td class="inner_page_frame"><div id="buttonsRow" style="padding: 8px; width: 650px;height:15px;"> <span id="buttonCopy" style="float:left;width: 540px;"> <strong>
                                <?
																		echo $lang['Create_Playlist'];
																	?>
                                </strong> (*
                                <?
																		echo $lang['Indicates_required_field'];
																	?>
                                ) </span> </div></td>
                          </tr>
                          <?php 
															if($ERROR != '')
														  ?>
                          <tr>
                            <td align="center"><br />
                              <font color="#FF0000">
                              <?php 
																	echo $ERROR;
																?>
                              </font></td>
                          </tr>
                          <?php ?>
                          <tr>
                            <td><table width="100%" cellpadding="3" class="dataEntryTable">
                                <form method="post" action="#" enctype="multipart/form-data" name="theForm" id="theForm">
                                  <tr>
                                    <td width="108" class="formLabel"><nobr>*
                                      <?
																			echo $lang['Playlist_Name'];
																		?>
                                      :</nobr> </td>
                                    <td width="300"><input name="field_title" type="text" value="<?php echo $field_title ?>" size="40" maxlength="60" class="inputbox" /></td>
                                  </tr>
                                  <tr valign="top">
                                    <td class="formLabel"><nobr>*
                                      <?
																			echo $lang['Description'];
																		?>
                                      :</nobr> </td>
                                    <td><textarea name="field_descr" cols="40" rows="4" class="inputbox"><?php echo $field_descr ?></textarea></td>
                                  </tr>
                                  <tr valign="top">
                                    <td class="formLabel"><nobr>
                                      <?
																			echo $lang['Tags'];
																		?>
                                      :</nobr> </td>
                                    <td><input type="text" size="40" maxlength="120" value="<?php echo $field_keywords ?>" name="field_keywords" class="inputbox" />
                                      <div class="smallText" style="width:450px;"><strong>
                                        <?
																				echo $lang['enter_tag'];
																			?>
                                        .</strong><br />
                                        <br />
                                        <?
																				echo $lang['Tags_are_keywords'];
																			?>
                                        : <code>
                                        <?
																				echo $lang['surfing_beach_waves'];
																			?>
                                        </code>.</div></td>
                                  </tr>
                                  <tr valign="top">
                                    <td class="formLabel"><?
																			echo $lang['Privacy'];
																		?>
                                      : </td>
                                    <td><input type="radio" id="privacyBox" name="field_privacy" value="PUBLIC" checked="checked" class="inputbox" />
                                      <?
																				echo $lang['Public'];
																			?>
                                      <br />
                                      <input type="radio" id="privacyBox" name="field_privacy" value="PRIVATE" />
                                      <?
																				echo $lang['Private'];
																			?>
                                    </td>
                                  </tr>
                                  <tr>
                                    <td class="formLabel"> </td>
                                    <input type="hidden" name="p" value="" />
                                    <input type="hidden" name="copy_list" value="" />
                                    <td class="formField"><input name="action_save" type="submit" value="<? echo $lang['Save_Playlist_Info'] ?>" class="button" />
                                      <input name="action_cancel" type="reset" value="<? echo $lang['Cancel']; ?>" class="button" /></td>
                                  </tr>
                                </form>
                              </table></td>
                          </tr>
                        </table></td>
                    </tr>
                  </table></td>
              </tr>
            </table></td>
        </tr>
      </table></td>
    <td width="6"><img src="<?php echo $SITEURL ?>images/1x1.gif" width="1" height="1" alt="" /></td>
  </tr>
</table>
<div align="center">
  <?php include("../bottom.php")?>
</div>
</body></html>

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/37070-help-with-code/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.