Hello, I am trying to create a form with php that echo data like this: "echo -e “username /npassword” > filename". I created the form and php embedded code but I cant seem to create variables with the text box names. We currently have a automated guest wifi account creation and I have to GUI the process. I am using radio buttons to create and delete because depending on thier options the username and password echo's to different file locations. Can anyone help because I am fairly new to PHP and I cant find any help searching for what I want. thanks

Here is What I have so far. Please let me know if I am doing this all wrong. Thanks

<html>
<head>
<title>FRHG Guest Wireless Account Creation or Deletion</title>
</head>

<body>
<h1 align= "center">Fremont-Rideout Health Group</h1>
<h1 align= "center">Guest Wireless</h1><br /><br /><br />

<?php
/*$uname = $_POST['uname'];
$pword = $_POST['pword'];
$create = $_POST['creation'];
$delete = $_POST['deletion'];*/

if(isset($_POST(['create']))
{

if($_POST['create'] == 'creation')
{
        echo -e  {$_POST['uname']} /n{$_POST['pword']} > /WifiGuestCreate/{$_POST['uname']};
}   
elseif($_POST['create'] == 'deletion')
{   
        echo -e  {$_POST['uname']} > /WifiGuestDelete/{$_POST['uname']};
}   
else
{
    echo "<p>Please select Create or Delete</p>";
}
}
?>

<form method= 'post' action= '<?php echo htmlentities $PHP_SELF;?>' id='form' accept-charset='UTF-8'>
<fieldset>
<legend>Account Creation/Deletion</legend><br /><br />
<label for='uname' >Username: </label>
<input type='text' size='30' maxlength='30' name='uname'><br /><br />
<label for='pword' >Password: </label>
<input type='password' size='30' maxlength='30' name='pword'><br /><br />
<input type='radio' name='create' value='creation' />Create
<input type='radio' name='create' value='deletion' />Delete<br /><br />
<input type='submit' name="submit" value='Submit' /><br /><br />
</fieldset>
</form>
<h5>*For Deleting feature, do not input Password</h5>

</body>
</html>

error it gives after pressing edit button is this

Notice: Undefined index: type in C:\xampp\htdocs\project\admin\users-edit-action.php on line 7

and this id the script on which it gives the error..i think error is due to wrong placement of values in radio buttons..

<?php include("../includes/config.php");?>
<?php
$id=$_POST["id"];
$firstname=$_POST["firstname"];
$lastname=$_POST["lastname"];
$email=$_POST["email"];
$type=$_POST["type"];

$con=mysql_connect($dbserver,$dbusername,$dbpassword);
if (!$con) { die('Could not connect: ' . mysql_error()); }


 mysql_select_db($dbname, $con);
$query=("UPDATE accounts SET firstname='".$firstname."' , lastname='".$lastname." email='".$email."' type='".$type."' WHERE (id='".$id."')");
$result = mysql_query($query);
echo "User has been updated Successfully!!";
mysql_close($con);
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.