a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Hosting from $3.99 per month!

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions. dd

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

Help with pHP script

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Help with pHP script
Page: [1]
 
piolilly

 

Posts: 13
Joined: 5/15/2005
Status: offline

 
Help with pHP script - 5/28/2005 8:54:43   
Hi,

I have these 2 forms. They are supposed to work with the php script to add a name to my mailing list, then view a name on request and delete it from the list. They aren't working yet and my entire project is waiting on this getting fixed. Can someone help?

Here are the forms:

Add a Name:

<form method="post" action="inter/process_form.php">
<input type="text" name="Name">
<input name="do" type="hidden" value="Add">
<input type="submit" name="submit" value="submit">
</form>

View a Name:

<form method="post" action="inter/process_form.php">
<input type="text" name="Name">
<input name="do" type="hidden" value="View">
<input type="submit" name="Submit" value="Get Name">
</form>

The delete function is suppose to show up on the new window the name is viewed in.

Here is the php script:

<?php

######################################
## Form is submitted to this file ##
######################################


require_once('includes/class.database.php');

$function_to_perform = $_POST['do'];
if (!isset($_POST['do'])) {

$function_to_perform = $_GET['do'];

}
$db = new Database;

switch($function_to_perform)
{
case "Add":
$db->AddName($_POST['Name']);
echo $_POST['Name']." Was Added To The Database";
echo "<br/><a href='?do=View'>Click Here To View Oldest Entry</a>";
break;

case "View":
$db->ViewName();
echo "<form action='' method='post'><input type='hidden' name='do' value='Delete' />";
echo "<input type='hidden' name='theirID' value='". $db->_id ."' />";
echo "Last Entry Was ". $db->_name ."  <input type='submit' name='delete' value='Delete'>";
echo "</form>";
break;

case "Delete":
$db->DeleteName($_POST['theirID']);
echo "Record Has Been Deleted";
break;

default:
echo "Please Submit A Valid Function To Process";
break;
}


?>

Can anyone see anything wrong? I would APPRECIATE the help VERY MUCH.

Thanks,

Blake
Page:   [1]
OutFront Discoveries

All Forums >> Web Development >> ASP and Database >> Help with pHP script
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts