Jump to content
  • Announcements

    • boen_robot

      Guidelines and Netiquette   03/28/2017

      Posting Problems:   Having problems posting your topic? Read through this: To join, you agree to our terms and conditions and fill out and submit a registration form. An activation email will be sent to your email adress, so you'll need to verify your account. After that the account has to be validated by one of the moderators. This will mean that it can take up to a day to be activated. A couple of things to remember to ensure approval: Don't use an email address in one of those $2 four character .com domains eg. xyds.com. These will be deleted and the domain added to the banned list. Don't use an email address that is within a domain with a bad reputation for spam. A Google search is run on every email address and email domain. Don't sign up with an email address that doesn't exist, doesn't work or requires the sender to answer a quiz before their email can get to you. Put your country and or state and city in the signup form. Blank forms will go to the botton of the "to do" list. And make sure that your email address and your country match, saying you're from Alabama and using a .ru email address is not going to get you activated. After a membership is activated the first few posts will be monitored. Posting spam or unapproved topics described in the agreement results in an immediate ban. The email provider and the IP addresses associated with the account will be banned and all posts will be deleted. These strict measures have been deemed necessary to hinder spam. Sorry for any inconvenience this causes, but it's not liable to change. If, after reading this, you still can't post and don't understand why, contact one of the Moderators listed here.   Topic Guidelines   Including the following information can expedite an accurate response from board members: Must be a Specific Problem or Question related to web design and development Include Code in Question (wrap with   for small blocks of code and for longer blocks   ) Include Code Author Include Extra Notes/Modifications/Attempts Include web link to page/file when possible Content Guidelines   You may not post, upload, link to, or email any Content that contains, promotes, gives instruction about, or provides prohibited Content. Prohibited Content includes any Content that breaks any local, state, county, national or international law. Prohibited Content also includes: No direct or indirect advertising or websites, forums, products, services No hijacking of posts (do not post your question in someone elses) Content that infringes upon any rights [ex. MP3s and ROMs] (including, but not limited to, copyrights and trademarks) Abusive, threatening, defamatory, racist, or obscene Viruses or any other harmful computer software False Information or libel Spam, chain letters, or Pyramid schemes Gambling or Illicit drugs Terrorism Hacking or cheating for internet/online games Warez, Roms, CD-Keys, Cracks, Passwords, or Serial Numbers Pornography, nudity, or sexual material of any kind Excessive profanity Invasive of privacy or impersonation of any person/entity Hacking materials or information Posting Tips   There are more BBcodes than there are buttons for on the reply menu. To get the full list, click "BB Code Help" underneath the clickable smilie face menu. Use   for small snippets of code Use   for lengthy snippets of code Use   if your snippet is HTML (optional) Use   if your snippet is SQL (optional) Rules of Conduct   Be nice. There's no need for calling someone stupid if they ask an 'easy' question. Keep your avatars and signatures absolutely child friendly. We have a younger audience on this forum. Keep your language appropriate for the same reason above. Do not PM moderators for help on the forum. Post on the topic, or create a new one.   Spam:   Recently, as you have all without doubt noticed, we have had lots of spam and advertisement on the forum. Therefore, we'd like to alert you as to what to do when you have found any of the aforementioned annoying messages: it. Immediately. Give a clear reason, please, if the advertising is not evident. DO NOT POST! Report, let the post stay as is, and we will get to it, meanwhile if you continue to post as normal in the other threads, it won't be on the top so long. Refrain from PMing the member. This won't help at all, as they are most likely spambots anyway. Thank you.       Images in signatures:   After thinking of users on dial-up, we have decided to enforce the following rules regarding signatures. Please pay heed to them. Respecting these rules is respecting the members on this forum with dial-up. Signature rules: No animated images AT ALL. No matter the amount of animation. Maximum image widthxheight: 300x150 Maximum image (file) size: 15kb Use calm colors. Do not use highly contrasting images in your signature, as this can get really annoying when seeing several posts from one member in the same thread. The same prohibited content goes for images as for posts. Lastly, use common sense. No lengthy signatures please. Save us some scrolling. Thank you.       Links in signatures:   Please understand that w3schools.com only exists because of voluntary work and is barely supported by the advertising littered throughout the tutorials and the forum. So, please, stop advertising other sites. DO not post links that drive traffic away from the w3schools domain - especially to a site that offers similar if not identical information. Please help support the site by keeping individuals on it. Thank you. Here are some guidelines as to what you can put in your signature: w3schools links --> allowed w3.org links --> allowed browser links --> allowed html editor links --> allowed personal sites --> allowed tutorial sites competing with w3schools --> NOT allowed sites completely irrelevant to webprogramming and this forum --> NOT allowed   Thanks for understanding, and for taking the time to read this. ~W3Schools Modstaff~
Sign in to follow this  
danjesama

Username that brings you to Email address.

Recommended Posts

danjesama    0

Hi Guys,

I have a form adds details to a table and one of them is owner email which takes in an email address. this in turn displays this email address on the form. 

What I am looking to do is for the form have the user just put in there username and the email address is automatically attached at the end(as all the details after@ in the email address will be the same). Then when the table is displaying the email address it just displays the username which when clicked still brings you to a new email to that email address.

Images:

50cd76660a825630c83798472aadb2ee.png so here it would be just username and @whatver.com is always on the form

d7706b38bacd14a3d9c8249ede0bb68f.png  and here it just displays the username so dmurran instead of the whole email address.

here is the code for the table:


// display data in table




echo "<table align='center' border='1' cellpadding='2' class='footable mdl-data-table mdl-js-data-table mdl-data-table--selectable mdl-shadow--4dp full-width'>";

echo "<tr> <th>ID</th> <th>Administration Console</th> <th>Product Version</th> <th>Platform</th> <th>Database</th> <th>Owner</th> <th>Status</th> <th></th> <th></th></tr>";



// loop through results of database query, displaying them in the table

while($row = mysql_fetch_array( $result )) {



// echo out the contents of each row into a table

echo "<tr>";

echo '<th>' . $row['id'] . '</th>';

echo '<td><a href="'.$row['curl'].'">'.$row['curl'].'</a></td>';

echo '<td>' . $row['pversion'] . '</td>';

echo '<td>' . $row['platform'] . '</td>';

echo '<td>' . $row['dversion'] . '</td>';

echo '<td><a href="mailto:'.$row['email'].'">' . $row['email'].'</a></td>';

echo '<td>' . $row['status'] .'</td>';


echo '<td><a href="php/edit.php?id=' . $row['id'] . '">Edit</a></td>';

echo '<td><a onclick="javascript:confirmationDelete($(this));return false;" href="php/delete.php?id=' . $row['id'] . '"onclick="return confirm("Do you want to delete this?")">Delete</a></td>';

echo "</tr>";

}





// close table>

echo "</table>";

?>

 

and here is the form:

<?php

/*

NEW.PHP

Allows user to create a new entry in the database

*/



// creates the new record form

// since this form is used multiple times in this file, I have made it a function that is easily reusable

function renderForm($curl, $pversion, $platform, $dversion, $email, $status, $error)

{

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>

<head>
    <link rel="stylesheet" type="text/css" href="../css/style.css"> 
    
    <link href='../css/bootstrap.cs' rel='stylesheet'>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
    <script src='../js/bootstrap.js'></script>

<title>New Repo</title>

</head>

<body>
    <div id="page-wrap">
    
     <center><a href="https://repo-project-danielmurran.c9users.io/view.php"><img src="../images/logo.png" alt="what image shows" height="90" width="300"></a></center>
     
     <h1>GCS Reproduction Environment</h1></br>
     
     <button  type="button" onclick="window.location='https://repo-project-danielmurran.c9users.io/view.php'">Home</button>
    
    <hr/>
    
    <h2> Add Reproduction</h2>
    
    

<?php

// if there are any errors, display them

if ($error != '')

{

echo '<div style="padding:4px; border:1px solid red; color:red;">'.$error.'</div>';

}

?>



    
<form  action="" method="post">

<div id="bform">
<table id="maintable" border='1' cellpadding='10'>
     <thead> 
        <tr>
<th>Repoduction Console URL: *<td><input type="text" name="curl" value="<?php echo $curl; ?>" /></td> </tr>

<th>Product Version: *<td> <input type="text" name="pversion" value="<?php echo $pversion; ?>" /></td></tr>

<th>Platform: * <td><input type="text" name="platform" value="<?php echo $platform; ?>" /></td></tr>

<th>Database: * <td><input type="text" name="dversion" value="<?php echo $dversion; ?>" /></td></tr>

<th>Owner Emaill: *  <td><input type="email" name="email" value="<?php echo $email; ?>" /> </td></tr>

<th>Repo Status: * <td><input type="text" name="status" value="<?php echo $status; ?>" /></td></tr>

</table>
* required

<input type="submit" name="submit" value="Submit">


</div>

</form>

</div>

</body>

</html>

<?php

}

// connect to the database

include('../php/connect-db.php');


// check if the form has been submitted. If it has, start to process the form and save it to the database

if (isset($_POST['submit']))

{

// get form data, making sure it is valid

$curl = mysql_real_escape_string(htmlspecialchars($_POST['curl']));

$pversion = mysql_real_escape_string(htmlspecialchars($_POST['pversion']));

$platform = mysql_real_escape_string(htmlspecialchars($_POST['platform']));

$dversion = mysql_real_escape_string(htmlspecialchars($_POST['dversion']));

$email = mysql_real_escape_string(htmlspecialchars($_POST['email']));

$status = mysql_real_escape_string(htmlspecialchars($_POST['status']));



// check to make sure all fields are entered

if ($curl == '' || $pversion == '' || $platform == '' || $dversion == '' || $email == '' || $status == '')

{

// generate error message

$error = 'ERROR: Please fill in all required fields!';



// if either field is blank, display the form again

renderForm($curl, $pversion, $platform, $dversion, $email, $status, $error);

}

else

{

// save the data to the database

mysql_query("INSERT INTO players SET curl='$curl', pversion='$pversion', platform='$platform', dversion='$dversion', email='$email', status='$status'")


or die(mysql_error());



// once saved, redirect back to the view page

header("Location: ../view.php");

}

}

else

// if the form hasn't been submitted, display the form

{

renderForm('','','','','','','');

}

?>

 

I tried to cut off the end of the email but it was not bringing me to the email address anymore.

 

Any help is appreciated.

 

Thanks!

Share this post


Link to post
Share on other sites
justsomeguy    940

If the only thing that changes is the account name, and the domain name is always the same, then it sounds like you should change that field to just ask for the account name and not the entire email address, and add the domain to it whenever you need the email address.  You can make that obvious in the form by writing the domain after the field, e.g.:

 

<input name="email">@domain.com

Share this post


Link to post
Share on other sites
danjesama    0
14 hours ago, justsomeguy said:

Hey, that is perfect for the new entry for the form, is there a way to just display the username and not @domain.com in the table though? and that it will still bring you to the email address once clicked

 

 

 

Share this post


Link to post
Share on other sites
justsomeguy    940

You can display whatever you want, you're the one writing the code.  You can make it do whatever you want it to do.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×