Welcome to Code Forum!

Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.

    GIF shows where to locate </> in the thread and or post editor toolbar.
    To learn more about how to use our BBCode feature, review our "How to post your code into threads" here.

    Thank you, Code Forum.

HTML & CSS N00b in need

Hey guys so I've been learning to code recently namely making a web app that links to an inventory spreadsheet I'm 98% of the way there but my web app isnt sending the inputs to the spreadsheet. Wondering if anyone can help ?
[CODE lang="html" title="Code"]</>
<html>
<head>
<base target="_top">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-6">
<form id="myForm" onsubmit="handleFormSubmit(this)">
<p class="h4 mb-4 text-center">Contact Details</p>

<div class="form-row">
<div class="form-group col-md-6">
<label for="first_name">First Name</label>
<input type="text" class="form-control" id="first_name" name="first_name" placeholder="First Name">
</div>
<div class="form-group col-md-6">
<label for="last_name">Last Name</label>
<input type="text" class="form-control" id="last_name" name="last_name" placeholder="Last Name">
</div>
</div>

<div class="form-row">
<div class="form-group col-md-6">
<p>Gender</p>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="gender" id="male" value="male">
<label class="form-check-label" for="male">Male</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="gender" id="female" value="female">
<label class="form-check-label" for="female">Female</label>
</div>
</div>
<div class="form-group col-md-6">
<label for="dateOfBirth">Date of Birth</label>
<input type="date" class="form-control" id="dateOfBirth" name="dateOfBirth">
</div>
</div>

<div class="form-group">
<label for="email">Email</label>
<input type="email" class="form-control" id="email" name="email" placeholder="Email">
</div>

<div class="form-group">
<label for="phone">Phone Number</label>
<input type="tel" class="form-control" id="phone" name="phone" placeholder="Phone Number">
</div>

<button type="submit" class="btn btn-primary btn-block">Submit</button>
</form>
<div id="output"></div>
</div>
</div>
</div>
</body>
</html></>>[/CODE]

[CODE title="Code2"]function doGet(request) {
return HtmlService.createTemplateFromFile("Index").evaluate();
}
/* @Include JavaScript and CSS Files */
function include(Index) {
return HtmlService.createHtmlOutputFromFile("Index")
.getContent();
}

/* @Process Form */
function processForm(formObject) {
var url = "https://docs.google.com/spreadsheets/d/1KY6sCXnOpU5DFLzqoE4dgx3W6mQ8bXKXK6c44mNWy1Y/edit?usp=sharing";
var ss = SpreadsheetApp.openByUrl(url);
var ws = ss.getSheetByName("Data");
ws.appendRow(["formObject".first_name,
"formObject".last_name,
"formObject".gender,
"formObject".dateOfBirth,
"formObject".email,
"formObject".phone]);
}[/CODE]
 
Hello CrumpledkingSkin,

What does 'handleFormSubmit' do?
What is the code server-side? You can send the data to a PHP page, by adding the following classes to the <form> element:
HTML:
<form action="process_form.php" method="post">

</form>
Within the PHP page, you can access the value of the <input> with the global array $_REQUEST.
 
Last edited:
Back
Top Bottom