This one has made me a lot of stress over the last couple of days. I am trying to set up a multi-page order form working with a CMS based on Typo3. However i am finding huge difficulties passing the session variables from a page to another. Session code is correct. I however suspect that i am not doing this accordingly to the CMS rulebook. So:
I have 4 pages in the order form. 4 .php files with 4 according .tpl files.
<form method="post" action="/index.php?puid=3&pageid=176">
<input type="radio" name="rubrik" onchange="toggleDiv('show',0);toggleDiv('check',0)" value="kfz" />KFZ
<br></br>
<input name="rubrik" id="immo" onchange="toggleDiv('show',1);toggleDiv('check',1)" type="radio" value="immobilien" class="static" />Immobilien
<input type="image" action="/index.php?puid=3&pageid=176" value="submit" src="/images/weiter.png" alt="Submit" style="float:right; margin-right:275px; margin-bottom:50px; margin-bottom:50px; margin-left:25px; text-align:left;" ></input>
</form>
This is my first form. In page1.tpl. page2.php starts like this:
<?php
session_start();
$_SESSION['Rubrik wahl'] = 'rubrik';
if (isset($_POST['rubrik'])){
$_SESSION['rubrik']=$_POST['rubrik'];
}
While in page.tpl i have:
<form method="post" action="/index.php?puid=3&pageid=177">
<textarea name="inhalt1" cols="40" rows="8" style="width:618px; height:200px;" onKeyDown="textCounter(document.inhalt.inhalt1,document.inhalt.counter,180)" onKeyUp="textCounter(document.inhalt.inhalt1,document.inhalt.counter,180)" ></textarea>
<input type="hidden" name="rubrik" value="<?php echo 'rubrik';?>"></input>
<br></br><br></br><br></br>
<input type="image" action="/index.php?puid=3&pageid=177" value="submit" src="/images/weiter.png" alt="Submit" style="margin-bottom:50px; margin-left:25px; text-align:left; float:right; margin-right:275px; margin-bottom:50px;"></input>
</form>
Now why does the 'rubrik' variable not pass from one page to another?
You are right. You are not doing it the way, you should do with TYPO3.
But i guess, you are just not using TYPO3 anyway. redFact is an commercial CMS build by the web agency newsagency. TYPO3 is a opensource CMS itself, it is build by an active community, but not by an single company.
So, at first check, if you are using TYPO3, if so buy an book or have a look at some extensions in TER and the API.
Have a look at $GLOBALS['TSFE']->fe_user->getKey, setKey and $GLOBALS['TSFE']->storeSessionData()
I guess, you are able to read german (your button is called "weiter"). So there are a lot of german TYPO3 books. Just buy some of them and start using the API. I know one pretty good book in english "Typo3 Extension Development" by Dmitry Dulepov, even it is from 2008, it is still valid for beginners.
Related
I have a WordPress site at www.itzfizz.com and have this custom SEO tool on this page https://itzfizz.com/seo-analyzer/ which basically tells the user the different ways to improve the content of a page/blog
I am trying to create a sidebar widget on my blog posts, where if a user types in their site, the query transfers from the search on the blog sidebar onto the SEO analyzer search bar.
I've used
<form method="get" action="https://itzfizz.com/seo-analyzer/?p=text">
<input type="text" name="keyword" />
</form>
<button type="submit">Analyze Website</button>
but the query isn't transferred to the SEO analyzer page (Search Box) as the URL is static, can someone recommend options I can follow.
Thanks a ton
Several things to fix:
The p parameter should be removed.
The url parameter which is the URL of the website to be analysed is missing in your form.
The submit button is outside the form, so it doesn't do anything
The output and ref parameters are missing. Since they are fixed they can just be hardcoded as hidden.
Here's the complete code for the form.
<form method="get" action="https://itzfizz.com/seo-analyzer/">
<input type="hidden" name="output" value="html"/>
<input type="hidden" name="ref" value="https://itzfizz.com/seo-analyzer/"/>
<input type="url" name="url" placeholder="https://www.yoursite.com" />
<button type="submit">Analyze Website</button>
</form>
Here is the Form Code i am using :
<form name="download_frm" action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">
<input type=hidden name="oid" value="***********">
<input type=hidden name="retURL" value="http://----/">
<!--<input type="hidden" name="debug" value="1"> -->
<p><input type="text" value="" name="name" id="name" maxlength="50" class="" placeholder="Name"/></p>
<p><input type="text" value="" name="mail" id="mail" maxlength="50" class="" placeholder="E-mail"/></p>
<p><input type="text" value="" name="org_name" id="org_name" maxlength="50" class="" placeholder="Organization Name"/></p>
<p>
<select name="org_typ" id="org_typ" >
<option selected="selected">Organization Type</option>
{if isset($orgtypes)}
{foreach $orgtypes as $array}
<option value="">{$array->Dev_Type}</option>
{/foreach}
{/if}
</select>
</p>
<p><input type="number" value="" name="phnum" id="phnum" maxlength="50" class="" placeholder="Phone Number(Optional)"/></p>
<p><input type="text" value="" name="cntry" id="cntry" maxlength="50" class="" placeholder="Country (Optional)"/></p>
<p><input type="submit" name="submit" id="submit" value="submit form" /></p>
</form>
After submitting the form,it is returning to the given returnURL.But i want to get the information whether the form data is stored successfully or not.
Please Advise me..
Thanks in Advance.
Because the Salesforce Web to Lead code is designed to work with all web servers / web sites / pages, by design it doesn't retrieve that information in regular usage. Whether the submission is successful, or fails, it will simply redirect the visitor to the page specified in retURL.
This behavior might be frustrating if you want information back, but it does allow the web-to-lead to be used practically anywhere, which is the point.
You can, in testing, enable debugging mode. See the original HTML produced by the Salesforce Web to Lead code generator. This will enable an intermediary page that will show you what is being submitted. However, you would not want to use this on a production site, as all of your customers would see this intermediary page.
If you're worried about rejected submissions, that is rare, and in any case Salesforce will send you an email with the submitted form values and why it failed. It will usually fail because of validation rules (to get around this, use Page Layout rules rather than validation rules if you want to require a field to be populated).
You still have a couple options to accomplish what you are trying to do.
One is simply to check Salesforce Leads for submissions - but I presume this information need to be processed, not just viewed by a human.
In that case, the rest of your options require you to do something more than use the standard web to lead code if you want your website to know about the form submission.
Presuming you're using a common CMS you can use plugins for Wordpress (Gravity Forms Salesforce Add-On or Wordpress to Lead) or Drupal's Webforms with the Salesforce add-on.
Or, alternatively, you can re-write the form as a PHP file (or a similar language) that passes the information to Salesforce via CURL - and does any other number of things at the same time using PHP, like passing it to another database. There's a lot on the internet - just google 'salesforce web to lead php curl'
All of the above options work for all versions of Salesforce. If you have Enterprise and higher, or Professional with the API, you can also pass the information to Salesforce via the API. This will allow you to bring back information such as the Lead ID - or pass the information to other objects, de-dupe, upsert, etc. Keep in mind this level of coding is both more complex and will require authentication into Salesforce, so only follow this option if the added functionality is worth the additional overhead.
I'm making a social network type site, where users can upload their items to be rated. However, I'm trying to improve the way the site is laid out, so want to automatically generate pages once the user inserts a new item. The add.php page has the following form:
<form action="add.php" method="post" autocomplete="on" enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" id="pic">
<p> <label for="jname" class="iconic user"> Name of Jam <span class="required">*</span></label> <input type="text" name="jname" id="jname" value="<?php if (isset($_POST['jname'])) echo $_POST['jname']; ?>" required="required" placeholder="Input your Name of Jam here" /> </p>
<p> <select name="jtype" id="jtype" value="<?php if (isset($_POST['jtype'])) echo $_POST['jtype']; ?>" required="required">
<option value="jam">Jam</option>
<option value="jelly">Jelly</option>
<option value="marmalade">Marmalade</option>
<option value="preserve">Preserve</option>
</select> </p>
<p> <label for="producer" class="iconic user"> Jam Producer <span class="required">*</span></label> <input type="text" name="producer" id="producer" value="<?php if (isset($_POST['producer'])) echo $_POST['producer']; ?>" required="required" placeholder="Input the producer of the Jam here" /> </p>
Upload a picture of your jam: </br> </br> <input name="userfile" type="file" /> </br>
<input type="submit" name="submit" value="Register" />
<input type="hidden" name="submitted" value="TRUE" />
</form>
When the form is submitted, I then want it to generate a new page for that new user created item. Is there a fairly simple way of doing this?
Cheers
You don't have to actually 'create' new html page for each item.
You could save this information to database (mysql for example).
Then you could create another php file, say 'item.php' and access different entries from mysql database like so:
item.php?id=1
This generally isn't the way such sites are created. (i.e.: You don't generate the physical pages themselves at the point of form submission.) Instead, you'd usually store the form data in a database and then retrieve/display it based on the URL - either by decoding the URL itself via a "controller" or by using a query string variable such as ?producerid=x. This data would then be used to populate a template.
To be honest, I'd really recommend getting hold of a recent PHP book (as far as database access is concerned, you should be using PDO or MySQLi) or following some online tutorials - whilst it might initially seem like this won't be a meaningful form of progress, its likely to pay substantial dividends in the long run.
The best and efficient way to do it is to store the data in a database and retrieve it whenever user clicks on specific item. One thing though, if part of your plan is to make your site accessible by google search engine, you have to generate the individual web pages... because, google is only a web crawler...it cant get into mysql or other databases.
Usually there's no new page generation for things like that. You should create a template and load dynamic informations from other sources (such an XML file or a database) to it so that it seems a completely new page.
Just:
See what each item page has in common
Define a template which contains the common code
Retrieve dynamic informations (item infos for example) from a database
Use PHP embedded in HTML to load dynamic HTML
An example:
Facebook does not create a new page per each user registration. There's an HTML template which defines the position of the profile photo, the position and style of the posts, the position and style of the friend list and stuff common to any profile page, and then just load different informations when you call such a page for Mark, Frank, Jeff and so on.
I would like to make a button on my website that automatically logs me in on another website. I recon I can use either Javascript/jQuery or PHP/cURL to do this.
Which is the best way to go?
You may use either remote javascript or iFrame. Find more details here: http://kuza55.blogspot.com/2007/06/building-secure-single-sign-on-systems.html
Also checkout google's approach named SAML: http://code.google.com/googleapps/domain/sso/saml_reference_implementation.html
It depends what the website is. JavaScript and jQuery alone cannot be used due to the cross-domain policy. You could perhaps use a combination of cURL and AJAX to achieve something similar.
I think you might need to provide a little more information about the site, and exactly why you'd want to do this...
I'm not sure if this is exactly what you're looking for, but one thing I have done in the past is to mimic the login form on the site you want to log in to.
For example lets say you want to log in to 'example.com'. In the source code for the login page of 'example.com' you will find the html code for the login form.
Example
<form name="blabla" action="action.php" method="post">
<input type="text" name="username" />
<input type="password" name="password" />
<input type="sumbit" value="Login" />
</form>
Create a form on your site similar to the one you find in 'example.com'. If you want you can even hide the fields, include values to make it a one button login. The trick is making sure that the action has the actual url. For example if the form says 'action.php' for 'example.com' you would put 'http://example.com/action.php'
Example
<form name="blabla" action="http://example.com/action.php" method="post">
<input type="hidden" name="username" value="testuser" />
<input type="hidden" name="password" value="testpass" />
<input type="sumbit" value="Login" />
<form>
This will log you in to the site in most cases. If you don't want to leave your own site you can set a 'target' for the form to an iframe or something.
I'm new to web development and have been wrestling with this problem for several hours now, so I've decided to turn to your wisdom. I'm trying to design a little webpage with a database for my wife to store her recipes in, but I'm having trouble getting form submission to work. Here is the code for the webpage where I take the form information in:
<html><body>
Enter the information below to add a new ingredient for use in your recipes.
<form action="add_to_database.php" method="post">
Name: <input name="name" type="text" />
Serving: <input type="text" name="serving" />
Calories: <input type="text" name="calories" />
<input type="submit" />
</form>
</body></html>
And here is some silly code I've been trying to display on the page to see if I can even get the form submission to work:
<html><body>
<?php
$name = $_POST['name'];
echo $name."<br />";
?>
</body></html>
Unfortunately, the page comes back as completely back (after I hit the submit button). What's absolutely baffling to me is that I've copied and pasted the examples from this page into some files and everything seems to work fine. So it seems as though apache and php are working correctly, but I'm messing up somewhere along the way. My apologies in advance if this seems like a stupid question but for the life of me I can't figure it out.
Do you name the other file as add_to_database.php where the form is submitted. Instead you can test on teh same page by removing the add_to_database.php from the form action.
form action="" method="post">
Name: <input name="name" type="text" />
Serving: <input type="text" name="serving" />
Calories: <input type="text" name="calories" />
<input type="submit" />
</form>
and write the php code on the same page as
$name = $_POST['name'];
echo $name;
If this is not working for you. Create a php file named test.php and type phpinfo(); there.
Verify that your page is indeed being processed by PHP - obvious question, but does your PHP file have a .php extension? Do other things like phpinfo() or echo "Test"; work?
Check the error log in /var/log/apache2/error.log or similar (if on Linux, dunno where that'd be on Windows).
Try turning display_errors on in the PHP configuration (this is a good idea only for a development install, not a production server).
a bit of a longshot, but if you can verify that php is pro essing the page. Clean up your html, you are missing the dtd, head, and encoding. . hard to say how a browser is going to interpret a form (missing a name attribute) without these.