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

5 Years
Discussion Span
Last Post by Riu 2009

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

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

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

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


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']};
    echo "<p>Please select Create or Delete</p>";

<form method= 'post' action= '<?php echo htmlentities $PHP_SELF;?>' id='form' accept-charset='UTF-8'>
<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 />
<h5>*For Deleting feature, do not input Password</h5>


Edited by davidbernardino: edited code.


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");?>

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!!";
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.