Jump to content

Recommended Posts

I am trying to manage an email list.  what I am using will show the list, you can add to the list and delete from the list, but when I want to update only the email is showing up and not the name.  Here is the code:

 

require 'connect.inc';

require 'admintop.php';

$canSave = $_POST["canSave"];

if($canSave == 1)

{

$action = $_POST["action"];

$email = $_POST["email"];

 

 

$name = (strlen($_POST["name"]) == 0) ? "null" : $_POST["name"];

$email = (strlen($_POST["email"]) == 0) ? "null" : $_POST["email"];

 

if($action == 1)

{

   

$sql="INSERT INTO subscribers (id,email,name) values ('', '$_POST', '$_POST[name]')";

$result = mysql_query($sql,$conn) or die(mysql_error());

$result_message = "Record Added...";

}

else

{

$sql = "update subscribers where email = $_POST";

$result = mysql_query($sql,$conn) or die(mysql_error());

$result_message = "Record Updated...";

}

 

$result = mysql_query($sql);

}

 

 

 

?>

<?php

$action = $_GET["action"];

$email = $_GET["email"];

if($action == 3)

{

   

$sql = "delete from subscribers where email = '$email'";

$result = mysql_query($sql);

$result_message = "Record Deleted...";

}

else if($action == 2)

{

    $getEvent = "SELECT * FROM subscribers where email = '$email'";

    $result = mysql_query($sql);

//$sql = "select * from subscribers where email = '$email'";

 

if (@mysql_num_rows($getEvent_res) > 0) {

while ($ev = @mysql_fetch_array($getEvent_res)) {

    $email = stripslashes($ev['email']);

$name = stripslashes($ev['name']);

$id= $row["id"];

$email= $row["email"];

    $name= $row["name"];

}

}

 

}

?>

<?php if($canSave == "" && ( $action == 1 || $action == 2 )) { ?>

<Br>

 

<table border=0 cellpadding=2 cellspacing=0 width=600 align=center>

<Tr><td width=50%>

<table border=0 cellpadding=2 cellspacing=0 width=300 align=center>

<tr><Td colspan=2 class="MainTitle">NewsMailer List <br></td></tr>

<form name=form1 action=newsmailerlist.php method=post onSubmit="return validate(form1)">

<tr><td class="GeneralText">Customer's Email</td><td>

          <input class="Input" name=email maxlength=150 value="<?=$email;?>" size="20"></td></tr>

<tr><td class="GeneralText">Customer's Name</td><td>

          <input class="Input" name=name maxlength=150 value="<?=$name;?>" size="20"></td></tr>

  <tr><td colspan=2 align=center><br><input type=submit value=submit class=button1></td></tr>

 

<input type=hidden name=action value=<?=$action;?>>

<input type=hidden name=canSave value=1>

<input type=hidden name=id  value=<?=$id;?>>

 

</form>

<?

 

Thank you

LadyDee

Link to comment
https://forums.phpfreaks.com/topic/147013-nee-help-with-a-display/
Share on other sites

sorry I do not understand what you mean by the short tags.

 

I am trying to perform action=2

 

This is what the customer can choose.

 

echo "<tr class=TableFields><td>$email<td>$name</td>";

echo "<td class=LinkText align=center><a href=newsmailerlist.php?action=2&email=$email>Edit</a></td>";

echo "<td class=LinkText align=center><a href=newsmailerlist.php?action=3&email=$email>Delete</a></td>";

 

Thank you

LadyDee

 

[attachment deleted by admin]

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.