deemurphy Posted February 26, 2009 Share Posted February 26, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/147013-nee-help-with-a-display/ Share on other sites More sharing options...
revraz Posted February 26, 2009 Share Posted February 26, 2009 Help us understand your logic and flow, which ACTION are we looking at? First thing I would do is drop the Short Tags. Quote Link to comment https://forums.phpfreaks.com/topic/147013-nee-help-with-a-display/#findComment-772141 Share on other sites More sharing options...
deemurphy Posted February 27, 2009 Author Share Posted February 27, 2009 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] Quote Link to comment https://forums.phpfreaks.com/topic/147013-nee-help-with-a-display/#findComment-772209 Share on other sites More sharing options...
revraz Posted February 27, 2009 Share Posted February 27, 2009 Short tags are <?= Use <?php echo instead Quote Link to comment https://forums.phpfreaks.com/topic/147013-nee-help-with-a-display/#findComment-772509 Share on other sites More sharing options...
deemurphy Posted February 27, 2009 Author Share Posted February 27, 2009 I used the following and still did not get name in the test box: value="<?php echo "$name";?>" LadyDee Quote Link to comment https://forums.phpfreaks.com/topic/147013-nee-help-with-a-display/#findComment-772691 Share on other sites More sharing options...
deemurphy Posted March 2, 2009 Author Share Posted March 2, 2009 I am still trying to get a solutin to this problem. Thank you LadyDee Quote Link to comment https://forums.phpfreaks.com/topic/147013-nee-help-with-a-display/#findComment-774669 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.